forked from ma6174/acmjudger
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjudge_result.py
More file actions
32 lines (29 loc) · 978 Bytes
/
judge_result.py
File metadata and controls
32 lines (29 loc) · 978 Bytes
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
#!/usr/bin/env python
# coding=utf-8
def judge_result(problem_id, solution_id, data_num):
low_level()
'''对输出数据进行评测'''
logging.debug("Judging result")
currect_result = os.path.join(
config.data_dir, str(problem_id), 'data%s.out' %
data_num)
user_result = os.path.join(
config.work_dir, str(solution_id), 'out%s.txt' %
data_num)
try:
curr = file(
currect_result).read(
).replace(
'\r',
'').rstrip(
) # 删除\r,删除行末的空格和换行
user = file(user_result).read().replace('\r', '').rstrip()
except:
return False
if curr == user: # 完全相同:AC
return "Accepted"
if curr.split() == user.split(): # 除去空格,tab,换行相同:PE
return "Presentation Error"
if curr in user: # 输出多了
return "Output limit"
return "Wrong Answer" # 其他WA