10963 - The Swallowing Ground
Moderator: Board moderators
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10963 - The Swallowing Ground
Change line 19 to:
for (j = 0; j < cols; j++)
for (j = 0; j < cols; j++)
Check input and AC output for thousands of problems on uDebug!
Re: 10963 - The Swallowing Ground
Thank you so much it was accepted.
Re: 10963 - The Swallowing Ground
WA three times.... Don't know why! plz help.........
Code: Select all
#include <stdio.h>
int main()
{
int a,b,c,d,k,m=0,n,i,j;
int arr[1000];
scanf("%d",&a);
for (i=0;i<a;i++){
printf("\n");
scanf("%d",&b);
c=0;
d=0;
k=b;
for (j=0;j<b;j++){
scanf("%d %d",&c,&d);
n=c-d;
if(n<0) n=n*(-1);
arr[j] = n;
}
}
for(i=0;i<a;i++){
for(j=0;j<k-1;j++){
if(arr[j+1] != arr[j]) m=1;
}
if(m==0) printf("yes\n\n");
else printf("no\n\n");
m=0;
}
return 0;
}
Re: 10963 - The Swallowing Ground
I've also got WA three times..
No idea why.
I tried to output all the result at once...
I think I've put the blanks correctly... Plz help...
Thanks in advance...
No idea why.
I tried to output all the result at once...
I think I've put the blanks correctly... Plz help...
Thanks in advance...
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
Code: Select all
removed after ac
Last edited by axelblaze on Fri Aug 08, 2014 2:54 am, edited 1 time in total.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10963 - The Swallowing Ground
The outputs of two consecutive cases will be separated by a blank line. You are both printing too many blank lines.
Check input and AC output for thousands of problems on uDebug!
Re: 10963 - The Swallowing Ground
For the 7th time got WA. Tried every way printing line(Two consecutive outputs & after or before last or first output) /not printing either way. Now i am helpless...........
Code: Select all
#include <stdio.h>
int main()
{
int a,b,c,d,k,m=0,n,i,j;
int arr[1000];
scanf("%d",&a);
for (i=0;i<a;i++){
//printf("\n");
scanf("%d",&b);
c=0;
d=0;
k=b;
for (j=0;j<b;j++){
scanf("%d %d",&c,&d);
n=c-d;
if(n<0) n=n*(-1);
arr[j] = n;
}
}
for(i=0;i<a;i++){
for(j=0;j<k-1;j++){
if(arr[j+1] != arr[j]) m=1;
}
if (i>0) printf("\n\n");
if(m==0) printf("yes");
else printf("no");
m=0;
}
return 0;
}
Re: 10963 - The Swallowing Ground
Which one shoould i do print a blank line between every test case & print blank line in consecutive outouts.. &
1.Print a new line before first output (got WA)
2.Print a new line after last output (got WA)
3.None (Which i have done in my last submission) (Still WA)
is there any problem in the input?
plz help with more test cases if possible........
1.Print a new line before first output (got WA)
2.Print a new line after last output (got WA)
3.None (Which i have done in my last submission) (Still WA)
is there any problem in the input?
plz help with more test cases if possible........
Last edited by Blief.S on Tue Jun 24, 2014 8:06 am, edited 2 times in total.
Re: 10963 - The Swallowing Ground
last WA submission...........
Code
Output
Code
Code: Select all
#include <stdio.h>
int main()
{
int a,b,c,d,k,m=0,n,i,j;
int arr[1000];
scanf("%d",&a);
for (i=0;i<a;i++){
scanf("%d",&b);
c=0;
d=0;
k=b;
for (j=0;j<b;j++){
scanf("%d %d",&c,&d);
n=c-d;
if(n<0) n=n*(-1);
arr[j] = n;
}
}
for(i=0;i<a;i++){
for(j=0;j<k-1;j++){
if(arr[j+1] != arr[j]) m=1;
}
if (i>0) printf("\n\n");
if(m==0) printf("yes");
else printf("no");
m=0;
}
return 0;
}
Code: Select all
2
5
2 1
0 -1
1 0
1 0
2 1
5
2 1
0 -1
1 0
1 0
2 1
yes
yes
Process returned 0 (0x0) execution time : 6.407 s
Press any key to continue.
Last edited by Blief.S on Tue Jun 24, 2014 8:04 am, edited 1 time in total.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10963 - The Swallowing Ground
Input:AC outputor as a string: "yes\n\nyes\n"
Code: Select all
2
5
2 1
0 -1
1 0
1 0
2 1
5
2 1
0 -1
1 0
1 0
2 1
Code: Select all
yes
yes
Check input and AC output for thousands of problems on uDebug!
Re: 10963 - The Swallowing Ground
I didn't print too much lines...The outputs of two consecutive cases will be separated by a blank line. You are both printing too many blank lines.
Code: Select all
3
5
2 1
0 -1
1 0
1 0
2 1
5
2 1
0 -1
1 0
1 0
2 1
5
2 1
0 -1
1 0
1 0
2 1
yes
yes
yes
Process returned 0 (0x0) execution time : 20.840 s
Press ENTER to continue.
![:(](./images/smilies/icon_frown.gif)
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10963 - The Swallowing Ground
The last code that you posted isn't printing a newline char at the end of the last line. You are printing: "yes\n\nyes"brianfry713 wrote:Input:AC outputCode: Select all
2 5 2 1 0 -1 1 0 1 0 2 1 5 2 1 0 -1 1 0 1 0 2 1
or as a string: "yes\n\nyes\n"Code: Select all
yes yes
Check input and AC output for thousands of problems on uDebug!
Re: 10963 - The Swallowing Ground
I submitted as you said but I still got a WA... What should I do...The last code that you posted isn't printing a newline char at the end of the last line. You are printing: "yes\n\nyes"
![:(](./images/smilies/icon_frown.gif)
![:(](./images/smilies/icon_frown.gif)
![:(](./images/smilies/icon_frown.gif)
Code: Select all
removed after ac
Last edited by axelblaze on Fri Aug 08, 2014 2:53 am, edited 1 time in total.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10963 - The Swallowing Ground
Now you're printing too many blank lines.
Remove line 12: cout << endl;
Change line 27 to: if(i!=0) cout<<endl;
Remove line 12: cout << endl;
Change line 27 to: if(i!=0) cout<<endl;
Check input and AC output for thousands of problems on uDebug!
Re: 10963 - The Swallowing Ground
Still no luck..!
![:(](./images/smilies/icon_frown.gif)
I've removed the 12th line and also changed the 27th line as you said.
by the way, the question said that there has to be blank line between each input. I think removing the 12th line won't satisfy that condition...
![:(](./images/smilies/icon_frown.gif)
![:(](./images/smilies/icon_frown.gif)
I've removed the 12th line and also changed the 27th line as you said.
by the way, the question said that there has to be blank line between each input. I think removing the 12th line won't satisfy that condition...
Code: Select all
removed after ac
Last edited by axelblaze on Fri Aug 08, 2014 2:53 am, edited 1 time in total.
Re: 10963 - The Swallowing Ground
wooh.. I got AC. I made a silly mistake last time. Thank you brianfry...
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)