11734 - Big Number of Teams will Solve This

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

Moderator: Board moderators

cse.mehedi
New poster
Posts: 36
Joined: Sun Mar 18, 2012 8:18 am

Re: 11734 why WA???

Post by cse.mehedi »

brianfry713 wrote:Input

Code: Select all

1
no spac        please
nospaceplease
AC output:

Code: Select all

Case 1: Wrong Answer
Thank you brianfry713. I got AC! :)
Evan72
New poster
Posts: 11
Joined: Sat Apr 28, 2012 2:01 pm

Post by Evan72 »

getting WA..not getting reason..help

#include<stdio.h>
#include<string.h>

int main()
{
char judge[50], team[50], test[50];
int i, n, tst, j;
scanf("%d", &n);
for(tst = 1; tst <= n; tst++)
{
scanf(" %[^\n]", team);
scanf(" %[^\n]", judge);
if(strcmp(team, judge) == 0)
printf("Case %d: Yes\n", tst);
else
{
for(i = 0, j = 0; team != '\0'; i++)
{
if(team == ' ')
continue;
else
{
test[j] = team;
j++;
}
}
test[j] = '\0';
if(strcmp(test, judge) == 0)
printf("Case %d: Output Format Error\n", tst);
else
printf("Case %d: Wrong Answer\n", tst);
}
}
return 0;
}
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11734 why WA???

Post by brianfry713 »

Input

Code: Select all

2
no space        please
nospaceplease
no space        please
no space please
AC output:

Code: Select all

Case 1: Output Format Error
Case 2: Output Format Error
Check input and AC output for thousands of problems on uDebug!
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 11734 why WA???

Post by uDebug »

brianfry713,

Thanks for the test cases.

Also, here's some other input / output I found useful during testing / debugging.

Input:

Code: Select all

5
t hisIsLarge but mor
thisIslarge
thisIsLarge                               
thisIsLarge
t                
this
                       
this
  LargeWo        rd
LargeWord
AC Output:

Code: Select all

Case 1: Wrong Answer
Case 2: Output Format Error
Case 3: Wrong Answer
Case 4: Wrong Answer
Case 5: Output Format Error
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.
mhsn06
New poster
Posts: 16
Joined: Tue Apr 01, 2014 7:36 pm

WA 11734 - Big Number of Teams will Solve This

Post by mhsn06 »

Getting WA!! Can't find bug. help please

Code: Select all

 Code Removed after got AC  :D 
Last edited by mhsn06 on Wed Aug 20, 2014 5:49 pm, edited 1 time in total.
lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: WA 11734 - Big Number of Teams will Solve This

Post by lighted »

Use search and check input in existing threads.
http://acm.uva.es/board/search.php?keyw ... 8e41046297
One example
brianfry713 wrote:Input

Code: Select all

2
no space        please
nospaceplease
no space        please
no space please
AC output:

Code: Select all

Case 1: Output Format Error
Case 2: Output Format Error
If you would say that you have same output with no error, you have problems with compiler. :D
Maybe in some compilers initialization of some variables coincides with zero value. That's why it works ok on your compiler.

Your output

Code: Select all

Case 1: Wrong Answer
Case 2: Wrong Answer
Last edited by lighted on Tue Sep 23, 2014 12:02 pm, edited 1 time in total.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
mhsn06
New poster
Posts: 16
Joined: Tue Apr 01, 2014 7:36 pm

Re: WA 11734 - Big Number of Teams will Solve This

Post by mhsn06 »

Finally got AC.
Check for the AC input. For future :D

Code: Select all

3
mmmmmmm
mmmmmmmmm
m m m
mmm
m                 m
m                 m

Code: Select all

Case 1: Wrong Answer
Case 2: Output Format Error
Case 3: Yes

There MUST be a newline after the last line.
8)
RedCode119
New poster
Posts: 13
Joined: Tue Jul 08, 2014 7:14 pm

Re: 11734 - Big Number of Teams will Solve This

Post by RedCode119 »

can't understand why " cin>>n " doesn't work. if i input the value of n and hit enter button, it takes the value of t(string) too. " getline(t); " and "cin>>n; " works togather, i cannot hit enter key between them. but i works after 2nd case . here's the code , pls help.......

Code: Select all

#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main()
{
    string t,j;
    int i,n,sp,k,y,cnt,len,len_t,len_j;
    cnt=1;
    cin>>n;
    while(n)
    {

        getline(cin,t);
        getline(cin,j);
        len_t=t.length();
        len_j=j.length();
        if(len_t>len_j)
            len=len_t;
        else
            len=len_j;
        sp=0;
        k=0;
        y=0;
       if(t[0]!=j[0])
        {
             y=1;
            goto here;
        }

        for(i=0;i<len;i++)
        {
            if(t[i]!=' ')
            {
                if(t[i]!=j[k])
                {
                    y=1;
                    break;
                }
                k++;


            }
            else
                sp=1;
        }
        here :
        if(y)
            cout<<"Case "<<cnt<<": Wrong Answer"<<endl;
        else if(sp)
            cout<<"Case "<<cnt<<": Output Format Error"<<endl;
        else
            cout<<"Case "<<cnt<<": Yes"<<endl;
        cnt++;
        n--;
    }
    return 0;
}
lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11734 - Big Number of Teams will Solve This

Post by lighted »

Try to add line

Code: Select all

cin>>n;

while (getchar() != '\n') ;

while(n)
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
ssavi
New poster
Posts: 28
Joined: Thu Nov 20, 2014 9:57 pm

Re: 11734 why WA???

Post by ssavi »

Hi v1n1t sir ,
v1n1t wrote:brianfry713,

Thanks for the test cases.

Also, here's some other input / output I found useful during testing / debugging.

Input:

Code: Select all

5
t hisIsLarge but mor
thisIslarge
thisIsLarge                               
thisIsLarge
t                
this
                       
this
  LargeWo        rd
LargeWord
AC Output:

Code: Select all

Case 1: Wrong Answer
Case 2: Output Format Error
Case 3: Wrong Answer
Case 4: Wrong Answer
Case 5: Output Format Error

May be the sample inputs are not given int the data set , my AC code does not match some of your input .... I have a question .... I can,t understood How the second input
result got Output Format Error ???I mean this one
thisIsLarge
thisIsLarge

And Output is :
Case 2: Output Format Error
Isn't it an ' Yes ' input sample ??? If Not then please show me the reason ?? please reply me.
I know I am a Failure Guy . :(
lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11734 - Big Number of Teams will Solve This

Post by lighted »

The first line is the team’s output and it contains extra spaces. You can check critical input on uDebug. http://www.udebug.com/UVa/11734
So correct answer is

Code: Select all

Case 2: Output Format Error
Each line consists of at least one and at most 20 characters.
But according to problem description this input is invalid. First line has length 42.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
al_noman
New poster
Posts: 1
Joined: Tue Apr 28, 2015 3:29 pm

Re: 11734 - Big Number of Teams will Solve This

Post by al_noman »

I am getting Wrong Answer. I can't find the bug. Below is my code

Code: Select all

#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;

int main()
{
	char teamInput[50], judgeInput[50];
	int numberOfTestCase, teamInputLength, judgeInputLength, i,j,spaceFlag, errorFlag;
	cin >> numberOfTestCase;
	gets(teamInput);

	for (int t = 0; t < numberOfTestCase; t++)
	{
		gets(teamInput);
		gets(judgeInput);

		spaceFlag = 0;
		errorFlag = 0;

		if (strcmp(teamInput, judgeInput) == 0)
		{
			printf("Case %d: Yes\n",(t+1));
		}

		else
		{
			teamInputLength = strlen(teamInput);
			judgeInputLength = strlen(judgeInput);

			if (judgeInputLength >= teamInputLength)
			{
				printf("Case %d: Wrong Answer\n", (t + 1));
				continue;
			}

			for (i = 0,j=0; i < teamInputLength ; i++,j++)
			{
				if (teamInput[i] == ' ')
				{
					spaceFlag = 1;
					i++;
				}

				if (teamInput[i] != judgeInput[j])
				{
					errorFlag = 1;
					break;
				}
			}

			if (errorFlag)
			{
				printf("Case %d: Wrong Answer\n", (t + 1));
			}

			else if (spaceFlag)
			{
				printf("Case %d: Output Format Error\n", (t + 1));
			}
		}
	}
	
	return 0;
}
Last edited by brianfry713 on Fri Jun 19, 2015 7:06 am, edited 1 time in total.
Reason: Added code blocks
Post Reply

Return to “Volume 117 (11700-11799)”