-
Notifications
You must be signed in to change notification settings - Fork 0
/
TokenGrader.cs
43 lines (39 loc) · 1.22 KB
/
TokenGrader.cs
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
using System;
using System.Collections.Generic;
namespace judge
{
public class TokenGrader : ICustomGrader
{
public bool Grade(Sio inputData, Sio referenceOutput, Sio submissionOutput)
{
string a = referenceOutput.Reader.ReadToEnd();
string b = submissionOutput.Reader.ReadToEnd();
var spl = a.Split(new []{" ","\n"}, StringSplitOptions.RemoveEmptyEntries);
var spl2 = b.Split(new []{" ","\n"}, StringSplitOptions.RemoveEmptyEntries);
var splf = new List<string>();
var splf2 = new List<string>();
foreach (var k in spl)
{
var p = k.Trim();
if (p != "\n" && p != "")
{
splf.Add(p);
}
}
foreach (var k in spl2)
{
var p = k.Trim();
if (p != "\n" && p != "")
{
splf2.Add(p);
}
}
if (splf.Count != splf2.Count) return false;
for (int i = 0; i < splf.Count; i++)
{
if (splf[i] != splf2[i]) return false;
}
return true;
}
}
}