Page 4 of 4
Re: 10188 - Automated Judge Script
Posted: Mon May 24, 2010 10:16 pm
by kabanek
I have a problem. This is my code:
Code: Select all
//problem no. 110305
//porównywanie wiersz po wierszu a nie wszystko naraz
#include <iostream>
#include <ctype.h>
#include <string>
using namespace std;
enum Verdict
{
AC,
PE,
WA
};
int main()
{
int n, m,
run = 0;
cin>>n;
cin.get();
Verdict verd;
while (n != 0)
{
verd = AC;
++run;
string digits1;
string chars1;
string digits2;
string chars2;
int *counts = new int [n];
for (int i=0; i<n; i++)
counts[i] = 0;
char c;
int i = 0;
while (i < n)
{
c = cin.get();
if (c == '\n')
i++;
counts[i]++;
if (isdigit(c))
digits1 += c;
else
chars1 += c;
}
cin>>m;
cin.get();
i = 0;
int *counts2 = new int [m];
for (int i=0; i<m; i++)
counts2[i] = 0;
while (i < m)
{
c = cin.get();
if (c == '\n')
i++;
counts2[i]++;
if (isdigit(c))
digits2 += c;
else
chars2 += c;
}
if (n != m)
verd = PE;
for (int i=0; i<n, i<m; i++)
if (counts[i] != counts2[i])
verd = PE;
if (digits1 != digits2)
verd = WA;
else
{
if (chars1 != chars2)
verd = PE;
}
switch (verd)
{
case WA:
cout<<"Run #"<<run<<": Wrong answer"<<endl;
break;
case PE:
cout<<"Run #"<<run<<": Presentatnio error"<<endl;
break;
default:
cout<<"Run #"<<run<<": Accepted"<<endl;
}
cin>>n;
cin.get();
}
return 0;
}
what do I do wrong? Or when my program make mistakes?
Re: 10188 - Automated Judge Script
Posted: Wed May 18, 2011 3:09 pm
by metaphysis
a solution is PE means every line PE.
a solution is WA means at least one line WA.
Re: 10188 - Automated Judge Script
Posted: Mon Jun 27, 2011 10:23 am
by plamplam
Well, try this case:
Code: Select all
2
I G0T WR0NG AN5W3R 2W1C3
1N TH15 5HITTY PR0BLEM
1
ALO0OOL0ASLA53ZXCXZW21XSLO3XCZ1CXLOQS1ZXC5ASD5XCZX0ASDLASDK
0
Re: 10188 - Automated Judge Script
Posted: Mon Jun 27, 2011 10:44 am
by plamplam
And btw @kabanek wtf is a "Presentatnio error" in your Code? Also in "Wrong answer" a should be capital (Wrong Answer). Plus your code doesn't show correct outputs.
Re: 10188 - Automated Judge Script
Posted: Mon Nov 07, 2011 4:24 pm
by metaphysis
metaphysis wrote:a solution is PE means every line PE.
a solution is WA means at least one line WA.
a solution is AC means All characters must match and must occur in the same order.
a solution is PE means All numeric characters match in the same order, but there is at least ONE non-matching non-numeric character.
for example:
3
The answer is: 10
The answer is: 5
The answer is: 5
3
The answer is: 1
The answer is: 05
The answer is: 5
0
you should output "Run #1: Presentation Error".
a solution is WA means it is not AC or PE.
sorry for my misunderstanding of this problem previously.
Re: 10188 - Automated Judge Script
Posted: Thu Dec 15, 2011 3:19 pm
by mahade hasan
why why wa
Re: 10188 - Automated Judge Script
Posted: Fri Jan 06, 2012 7:23 pm
by mahade hasan
why why i got wa... plz help me otherwise i will tern mad
here my code
Code: Select all
[color=#40FFBF]
#include<stdio.h>
#include<string.h>
int main()
{
char Judge[200][200],Ans[200][200],jud[200],ans[200];
int I,L=0,K,M,N,Jd,An,Count=0;
while(scanf("%d",&Jd)!=EOF)
{
if(Jd==0) break;
++Count;
L=0;
for(I=0;I<200;I++)
{
jud[I]='\0';
ans[I]='\0';
}
scanf("\n");
for(I=1;I<=Jd;I++)
{
gets(Judge[I]);
}
scanf("%d",&An);
scanf("\n");
for(I=1;I<=An;I++)
{
gets(Ans[I]);
}
N=0;
for(I=1;I<=An;I++)
{
if(strcmp(Judge[I],Ans[I])==0) ++N;
else break;
}
if(Jd==N&&N==An) printf("Run #%d: Accepted\n",Count);
else
{
K=0;
for(I=1;I<=Jd;I++)
{
M=0;
while(Judge[I][M]!='\0')
{
if(Judge[I][M]>47&&Judge[I][M]<58) { jud[K]=Judge[I][M]; ++K; }
++M;
}
}
K=0;
for(I=1;I<=An;I++)
{
M=0;
while(Ans[I][M]!='\0')
{
if(Ans[I][M]>47&&Ans[I][M]<58) { ans[K]=Ans[I][M]; ++K; }
++M;
}
}
if(strcmp(jud,ans)==0) printf("Run #%d: Presentation Error\n",Count);
else printf("Run #%d: Wrong Answer\n",Count);
}
}
return 0;
}[/color]
Re: 10188 - Automated Judge Script
Posted: Fri Jun 22, 2012 2:58 pm
by aksmit
I keep getting WA and I have tried all the sample cases provided in the above threads. They work fine on my system. Please somebody do tell whats wrong with my submission.
Code: Select all
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
string extractNumerics(string str) {
string numeric = "";
for (int i = 0; i<str.size(); i++) {
if (str[i] >= '0' && str[i] <= '9')
numeric += str[i];
}
return numeric;
}
int main() {
// freopen("input.in", "r", stdin);
int n, m;
int run = 1;
while (true) {
string input;
getline(cin, input);
n = atoi((char *)input.c_str());
if (n == 0) break;
string correct = "";
for (int i = 0; i<n; i++) {
getline(cin, input);
correct += input;
}
getline(cin, input);
m = atoi((char *)input.c_str());
string submitted = "";
for (int i = 0; i<m; i++) {
getline(cin, input);
submitted += input;
}
printf ("Run #%d: ", run++);
if (!correct.compare(submitted))
printf ("Accepted\n");
else {
string str1 = extractNumerics(correct);
string str2 = extractNumerics(submitted);
if (!str1.compare(str2))
printf ("Presentation Error\n");
else printf ("Wrong Answer\n");
}
}
}
Re: 10188 - Automated Judge Script
Posted: Tue Jun 26, 2012 12:07 am
by brianfry713
Re: 10188 - Automated Judge Script
Posted: Thu Sep 06, 2012 6:04 am
by three0s
My experience:
when you catenate the strings you have to remember to add the '\n'
Re: 10188 - Automated Judge Script
Posted: Fri Oct 04, 2013 8:48 pm
by Angry Bird
Why Givving Runtime Error???
Code: Select all
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
for(int o=1; ;o++){
int t,t1,ut,l,l1,count=0,cou=0;
char conv[10];
vector<string>cs,cs1;
vector<int>ii,ii1;
cin>>t;
getchar();
if(t==0)
break;
string s,s1;
for(int i=0; i<t; i++)
{
getline(cin,s);
cs.push_back(s);
}
cin>>t1;
getchar();
for(int i=0; i<t1; i++)
{
getline(cin,s1);
cs1.push_back(s1);
}
if(cs.size()>cs1.size())
{
l=cs.size();
}
else if(cs.size()<cs1.size())
{
l=cs1.size();
}
else
{
l=cs.size();
}
for(int i=0; i<l; i++)
{
if(cs[i]==cs1[i])
{
count++;
}
}
cout<<"Run #"<<o<<": ";
if((((count==l))&&(count==l))&&(t==t1))
{
cout<<"Accepted"<<endl;
}
else
{
for(int i=0; i<cs.size(); i++)
{
for(int j=0; j<cs[i].size(); j++)
{if(isdigit(cs[i][j]))
ii.push_back(cs[i][j]);}
}
for(int i=0; i<cs1.size(); i++)
{
for(int j=0; j<cs1[i].size(); j++)
{if(isdigit(cs1[i][j]))
ii1.push_back(cs1[i][j]);}
}
if(ii.size()>=ii1.size())
{
l1=ii.size();
}
else
{
l1=ii1.size();
}
for(int i=0; i<l1; i++)
{
if(ii[i]==ii1[i])
{
cou++;
}
}
if((cou==l1)&&(l1==ii.size())&&(l1==ii1.size()))
{
cout<<"Presentation Error"<<endl;
}
else
{
cout<<"Wrong Answer"<<endl;
}
}
}
return 0;
}
Re: 10188 - Automated Judge Script
Posted: Tue Oct 08, 2013 1:51 am
by brianfry713
Re: 10188 - Automated Judge Script
Posted: Tue Oct 08, 2013 5:47 pm
by Angry Bird

Giving both Presentation Error.
Re: 10188 - Automated Judge Script
Posted: Tue Oct 08, 2013 10:06 pm
by brianfry713
The code you posted is throwing a RE on that input. See
http://ideone.com/78Gdm0