Page 3 of 4

Re: 10963 - The Swallowing Ground

Posted: Wed Nov 20, 2013 10:19 pm
by brianfry713
Change line 19 to:
for (j = 0; j < cols; j++)

Re: 10963 - The Swallowing Ground

Posted: Thu Nov 21, 2013 6:40 am
by NickStern
Thank you so much it was accepted.

Re: 10963 - The Swallowing Ground

Posted: Mon Jun 23, 2014 6:17 am
by Blief.S
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

Posted: Mon Jun 23, 2014 7:56 pm
by axelblaze
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... :) :) :)

Code: Select all

removed after ac

Re: 10963 - The Swallowing Ground

Posted: Mon Jun 23, 2014 11:58 pm
by brianfry713
The outputs of two consecutive cases will be separated by a blank line. You are both printing too many blank lines.

Re: 10963 - The Swallowing Ground

Posted: Tue Jun 24, 2014 7:45 am
by Blief.S
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

Posted: Tue Jun 24, 2014 7:59 am
by Blief.S
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........

Re: 10963 - The Swallowing Ground

Posted: Tue Jun 24, 2014 8:01 am
by Blief.S
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.

Re: 10963 - The Swallowing Ground

Posted: Tue Jun 24, 2014 7:39 pm
by brianfry713
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"

Re: 10963 - The Swallowing Ground

Posted: Tue Jun 24, 2014 11:56 pm
by axelblaze
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... :(

Re: 10963 - The Swallowing Ground

Posted: Wed Jun 25, 2014 7:38 pm
by brianfry713
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"

Re: 10963 - The Swallowing Ground

Posted: Wed Jun 25, 2014 8:16 pm
by axelblaze
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

Re: 10963 - The Swallowing Ground

Posted: Thu Jun 26, 2014 8:01 pm
by brianfry713
Now you're printing too many blank lines.
Remove line 12: cout << endl;
Change line 27 to: if(i!=0) cout<<endl;

Re: 10963 - The Swallowing Ground

Posted: Fri Jun 27, 2014 9:11 pm
by axelblaze
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

Re: 10963 - The Swallowing Ground

Posted: Mon Jun 30, 2014 9:24 pm
by axelblaze
wooh.. I got AC. I made a silly mistake last time. Thank you brianfry... :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :)