diff --git a/usacooj.h b/usacooj.h new file mode 100644 index 0000000..c83d09c --- /dev/null +++ b/usacooj.h @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +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 start, end; + start = chrono::system_clock::now(); + code(fin, fout); + end = chrono::system_clock::now(); + chrono::duration 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; + } +} \ No newline at end of file