Skip to content

Commit db5377b

Browse files
committed
add wrong answer result
1 parent e4a8ec6 commit db5377b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/tasks/submission.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,24 @@ class SubmissionScenario implements Scenario {
6161
const runOutputFile = path.join(currentTestcasePath, 'run.stdout')
6262
const expectedOutputFile = path.join(currentTestcasePath, 'stdout')
6363

64+
const diff = exec(`
65+
diff -b -a ${runOutputFile} ${expectedOutputFile}
66+
`)
67+
const score = diff.code === 0 ? 100 : 0
68+
6469
const result = new Array(
6570
+code === 143 && "TLE",
6671
+code === 137 && "MLE",
6772
+code !== 0 && "Run Error",
73+
+code === 0 && score === 0 && "Wrong Answer",
6874
+code === 0 && "Success"
6975
).reduce((acc, cur) => acc || cur)
70-
71-
const diff = exec(`
72-
diff -b -a ${runOutputFile} ${expectedOutputFile}
73-
`)
7476

7577
return {
7678
id: +testcase,
7779
time,
7880
result,
79-
score: diff.code === 0 ? 100 : 0
81+
score
8082
}
8183
})
8284

0 commit comments

Comments
 (0)