forked from laekov/acejudge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
acejudge.cc
63 lines (61 loc) · 1.09 KB
/
acejudge.cc
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
60
61
62
63
/*
* Ace Judge
* Source code
* A simple judge software for OIers
* Code by CDQZ_laekov
* Version on linux
* Last change on 01/04 2015
*/
#include "acejudge.h"
int main(int argc, char* args[]) {
//puts("RUNNING");
bool flag = 1, fastrun = 0;
freopen(".ajruntime", "w", stderr);
system("mkdir .ajtest");
compile_init();
prob_cfg ccfg;
for (int i = 1; i < argc; ++ i)
if (args[i][0] != '-')
ccfg. load(args[i]);
for (int i = 1; i < argc; ++ i)
if (args[i][0] == '-') {
if (!strcmp(args[i] + 1, "fast"))
fastrun = 1;
else if (!strcmp(args[i] + 1, "l")) {
ccfg. show();
return 0;
}
else if (!strcmp(args[i] + 1, "help")) {
show_help();
return 0;
}
else if (!strcmp(args[i] + 1, "version")) {
show_version();
return 0;
}
}
if (fastrun) {
judge(ccfg, 1);
}
else {
while (1) {
if (flag)
show_cmd(), flag = 0;
switch (get_cmd()) {
case 'C':
config(ccfg);
flag = 1;
break;
case 'R':
judge(ccfg, 0);
flag = 1;
break;
case 'Q':
return 0;
default:
flag = 0;
break;
}
}
}
}