## 10963 - The Swallowing Ground

Moderator: Board moderators

brianfry713
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++)
Check input and AC output for thousands of problems on uDebug!

NickStern
New poster
Posts: 3
Joined: Wed Nov 20, 2013 1:29 am

### Re: 10963 - The Swallowing Ground

Thank you so much it was accepted.

Blief.S
New poster
Posts: 16
Joined: Wed Jun 18, 2014 9:03 pm

### 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;

}
``````

axelblaze
New poster
Posts: 34
Joined: Mon Jun 23, 2014 7:45 pm

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

Code: Select all

``removed after ac``
Last edited by axelblaze on Fri Aug 08, 2014 2:54 am, edited 1 time in total.

brianfry713
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!

Blief.S
New poster
Posts: 16
Joined: Wed Jun 18, 2014 9:03 pm

### 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;

}
``````

Blief.S
New poster
Posts: 16
Joined: Wed Jun 18, 2014 9:03 pm

### 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........
Last edited by Blief.S on Tue Jun 24, 2014 8:06 am, edited 2 times in total.

Blief.S
New poster
Posts: 16
Joined: Wed Jun 18, 2014 9:03 pm

### Re: 10963 - The Swallowing Ground

last WA submission...........
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;

}
``````
Output

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.

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

### Re: 10963 - The Swallowing Ground

Input:

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
``````
AC output

Code: Select all

``````yes

yes
``````
or as a string: "yes\n\nyes\n"
Check input and AC output for thousands of problems on uDebug!

axelblaze
New poster
Posts: 34
Joined: Mon Jun 23, 2014 7:45 pm

### 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.
I didn't print too much 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.``````
it's just like it's should be...

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

### Re: 10963 - The Swallowing Ground

brianfry713 wrote:Input:

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
``````
AC output

Code: Select all

``````yes

yes
``````
or as a string: "yes\n\nyes\n"
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"
Check input and AC output for thousands of problems on uDebug!

axelblaze
New poster
Posts: 34
Joined: Mon Jun 23, 2014 7:45 pm

### 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"
I submitted as you said but I still got a WA... What should I do...

Code: Select all

``removed after ac``
Last edited by axelblaze on Fri Aug 08, 2014 2:53 am, edited 1 time in total.

brianfry713
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;
Check input and AC output for thousands of problems on uDebug!

axelblaze
New poster
Posts: 34
Joined: Mon Jun 23, 2014 7:45 pm

### Re: 10963 - The Swallowing Ground

Still no luck..!
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.

axelblaze
New poster
Posts: 34
Joined: Mon Jun 23, 2014 7:45 pm

### Re: 10963 - The Swallowing Ground

wooh.. I got AC. I made a silly mistake last time. Thank you brianfry...