Temporary fix for abort race
This commit is contained in:
parent
3ef47518ee
commit
1004563a53
3 changed files with 31 additions and 3 deletions
24
judge/tasks/experiment.py
Normal file
24
judge/tasks/experiment.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
from collections import defaultdict
|
||||
from judge.models import SubmissionTestCase, Problem
|
||||
|
||||
|
||||
def generate_report(problem):
|
||||
testcases = SubmissionTestCase.objects.filter(submission__problem=problem).all()
|
||||
|
||||
score = defaultdict(int)
|
||||
total = defaultdict(int)
|
||||
rate = defaultdict(int)
|
||||
|
||||
for case in testcases.iterator():
|
||||
score[case.case] += int(case.status == 'AC')
|
||||
total[case.case] += 1
|
||||
|
||||
for i in score:
|
||||
rate[i] = score[i] / total[i]
|
||||
|
||||
for i, _ in sorted(rate.items(), key=lambda x: x[1], reverse=True):
|
||||
print(i, score[i], total[i], rate[i])
|
||||
|
||||
def test(code):
|
||||
problem = Problem.objects.get(code=code)
|
||||
generate_report(problem)
|
Loading…
Add table
Add a link
Reference in a new issue