blob: c83d09c8585a6f4ba98e2055d55bd6de25570ccf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#include <algorithm>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;
void code(ifstream& cin, ofstream& cout);
int main() {
ios_base::sync_with_stdio(false);
int TC = 1, cnt = 0;
while (fopen((to_string(TC)+".in").c_str(), "r")) {
ifstream fin(to_string(TC)+".in");
ofstream fout("out");
fin.tie(NULL), fout.tie(NULL);
chrono::time_point<std::chrono::system_clock> start, end;
start = chrono::system_clock::now();
code(fin, fout);
end = chrono::system_clock::now();
chrono::duration<double> elapsed_time = end - start;
ifstream out("out");
ifstream ans(to_string(TC)+".out");
string s, t;
bool AC = true;
while (getline(out, s) && getline(ans, t) && AC) {
if (s != t) AC = false;
}
cout << "Test case " << TC << ": ";
if (elapsed_time.count() > 2000) {
cout << "TLE" << '\n';
}
else if (AC) {
cout << "AC" << '\n';
cnt++;
}
else {
cout << "WA" << '\n';
}
cout << "Elapsed time: " << 1000 * elapsed_time.count() << " milliseconds\n";
remove("out");
TC++;
}
if (cnt == --TC) {
cout << "All AC!" << endl;
}
else {
cout << cnt << " / " << TC << endl;
}
}
|