10188 - Automated Judge Script

All about problems in Volume 101. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

kabanek
New poster
Posts: 1
Joined: Mon May 24, 2010 10:11 pm

Re: 10188 - Automated Judge Script

Post 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?

metaphysis
Experienced poster
Posts: 139
Joined: Wed May 18, 2011 3:04 pm

Re: 10188 - Automated Judge Script

Post by metaphysis »

a solution is PE means every line PE.
a solution is WA means at least one line WA.

plamplam
Experienced poster
Posts: 150
Joined: Fri May 06, 2011 11:37 am

Re: 10188 - Automated Judge Script

Post by plamplam »

Well, try this case:

Code: Select all

2
I G0T WR0NG AN5W3R 2W1C3
1N TH15 5HITTY PR0BLEM
1
ALO0OOL0ASLA53ZXCXZW21XSLO3XCZ1CXLOQS1ZXC5ASD5XCZX0ASDLASDK
0

Code: Select all

Run #1: Presentation Error
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson

plamplam
Experienced poster
Posts: 150
Joined: Fri May 06, 2011 11:37 am

Re: 10188 - Automated Judge Script

Post 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.
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson

metaphysis
Experienced poster
Posts: 139
Joined: Wed May 18, 2011 3:04 pm

Re: 10188 - Automated Judge Script

Post 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.

mahade hasan
Learning poster
Posts: 87
Joined: Thu Dec 15, 2011 3:08 pm
Location: University of Rajshahi,Bangladesh

Re: 10188 - Automated Judge Script

Post by mahade hasan »

why why wa
Last edited by mahade hasan on Fri Jan 06, 2012 7:25 pm, edited 1 time in total.
we r surrounded by happiness
need eyes to feel it!

mahade hasan
Learning poster
Posts: 87
Joined: Thu Dec 15, 2011 3:08 pm
Location: University of Rajshahi,Bangladesh

Re: 10188 - Automated Judge Script

Post 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]
Last edited by mahade hasan on Mon Aug 06, 2012 12:48 am, edited 1 time in total.
we r surrounded by happiness
need eyes to feel it!

aksmit
New poster
Posts: 1
Joined: Thu Jun 21, 2012 9:32 pm

Re: 10188 - Automated Judge Script

Post 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");
		}
	}
}

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10188 - Automated Judge Script

Post by brianfry713 »

Input:

Code: Select all

2
a
a
1
aa
0
Correct output:

Code: Select all

Run #1: Presentation Error
Check input and AC output for thousands of problems on uDebug!

three0s
New poster
Posts: 3
Joined: Sat Aug 04, 2012 9:52 am

Re: 10188 - Automated Judge Script

Post by three0s »

My experience:
when you catenate the strings you have to remember to add the '\n'

Angry Bird
New poster
Posts: 21
Joined: Mon Apr 08, 2013 8:38 am

Re: 10188 - Automated Judge Script

Post 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;
}


brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10188 - Automated Judge Script

Post by brianfry713 »

Try Input:

Code: Select all

2
a
a
1
a
1
a
2
a
a
0
Check input and AC output for thousands of problems on uDebug!

Angry Bird
New poster
Posts: 21
Joined: Mon Apr 08, 2013 8:38 am

Re: 10188 - Automated Judge Script

Post by Angry Bird »

:o Giving both Presentation Error.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10188 - Automated Judge Script

Post by brianfry713 »

The code you posted is throwing a RE on that input. See http://ideone.com/78Gdm0
Check input and AC output for thousands of problems on uDebug!

Post Reply

Return to “Volume 101 (10100-10199)”