The automated judge script problem (uva 10188) is sequence checker programming challenge in competitive programming. Which can be stated as (from online judge)
write an automated judge script to judge solution runs from teams all over the world. All you have to do is write a program which receives the standard solution and a team output and gives as answer one of the following messages: “Accepted”, “Presentation Error” or “Wrong Answer”. We define each one as:
Accepted: Give ‘Accepted’ as answer if the team output matches the standard solution integrally. That is, ALL characters must match and must be in the same order.
Presentation Error: We want you to give ‘Presentation Error’ if all NUMERIC characters match (and in the same order) but there is at least one non-numeric character wrong (or in wrong order). For instance, ‘15 0’ and ‘150’ would receive a ‘Presentation Error’, whereas ‘15 0’ and ‘1 0’ would not (it would receive ‘Wrong Answer’, see bellow).
Wrong Answer: If the team output could not be classified as any of the two above, then you have no option but to give ‘Wrong Answer’ as an answer!
The problem is pretty straight, here we just have to look for sequence of numbers in strings. We do not consider any alphabetical character. If all numbers sequence matches then print "Accepted", if sequence not match but every number present in both strings then print "Presentation error" else print "Wrong Answer"
Sample Input
2
The answer is: 10
The answer is: 5
2
The answer is: 10
The answer is: 5
2
The answer is: 10
The answer is: 5
2
The answer is: 10
The answer is: 15
3
Input Set #1: YES
Input Set #2: NO
Input Set #3: NO
3
Input Set #0: YES
Input Set #1: NO
Input Set #2: NO
1
1 0 1 0
1
1010
1
The judges are mean!
1
The judges are good!
0
Run #1: Accepted
Run #2: Wrong Answer
Run #3: Wrong Answer
Run #4: Presentation Error
Run #5: Presentation Error
Explanation
We just have to check character(numbers) matching in two strings if no then check for presence of all characters(numbers) from two strings in both strings else print as 'wrong answer'.
Code
import re
Final_answer, std, obt = list(), list(), list()
str1 = str()
def Split(a):
temp = str()
try:
int(a[0])
start = 0
except:
start = 1
if(len(a) > 2):
for i in range(start, len(a), 2):
temp += a[i]
else:
temp = a
return temp
def CheckPresentation(A, B, count):
for i in range(0, count):
a = re.split('(\d+)',A[i])
b = re.split('(\d+)',B[i])
a = Split(a[1:len(a)-1])
b = Split(b[1:len(b)-1])
if(len(a) == len(b)):
for i in range(0, len(a)):
if(a[i] == b[i]):
continue
else:
return False
else:
continue
else:
return True
while(True):
count = 1
temp = int(input())
if(temp<=0):
break
if(temp == 2):
str1 = 'The answer is: '
else:
str1 = 'Input Set #'
for i in range(0,temp):
std.append(input(str1))
temp1 = int(input())
if(temp != temp1):
break
for i in range(0,temp1):
obt.append(input(str1))
if(std == obt):
Final_answer.append("Run #"+str(count)+": Accepted")
else:
if(CheckPresentation(std, obt, temp) == True):
Final_answer.append("Run #"+str(count)+": Presentation Error")
else:
Final_answer.append("Run #"+str(count)+": Wrong Answer")
count+=1
print(Final_answer)
After taking two strings as input from user, we just compare them using equality operator, if it return true "Accepted" will be printed, else call check_presentation() function to check presence of characters(numbers) in both strings, if it return true then print "Presentation error" else print "Wrong answer".
Since, in example 5 where no matching numerical found our algorithm will return "presentation error".
Hope, this article found helpful to you, thank you.
Related keywords: automated judge script, automated judge script problem, automated judge script programming challenge, automated judge script uva, automated judge script online judge, automated judge script explanation, automated judge script solution, automated judge script source code, automated judge script python, uva 10188, uva 10188 problem, uva 10188 explanation.
Comments
Post a Comment