10102 getting Wrong Answer , please help me to solve it

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

Post Reply
back bencher
New poster
Posts: 2
Joined: Sun Mar 12, 2017 9:15 pm

10102 getting Wrong Answer , please help me to solve it

Post by back bencher » Mon Mar 13, 2017 9:11 am

I dont know why I am getting wrong answer. Please help me to find it.
Attachments
10102.zip
(639 Bytes) Downloaded 16 times
Last edited by back bencher on Wed Mar 15, 2017 7:09 am, edited 3 times in total.

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: getting WA in 10102 , please help me to solve it

Post by lighted » Tue Mar 14, 2017 1:43 pm

Your code gets compile error.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

back bencher
New poster
Posts: 2
Joined: Sun Mar 12, 2017 9:15 pm

Re: 10102 getting Wrong Answer , please help me to solve it

Post by back bencher » Wed Mar 15, 2017 7:08 am

Dear Mr. lighted ,
some parts of the proper code is missing in the pasted code and I could not pest/edit it properly . Please check the attachment and you will find the proper code.Thanks for helping me.

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 10102 getting Wrong Answer , please help me to solve it

Post by lighted » Wed Mar 15, 2017 3:57 pm

You initialized variable e by value 1, so your code always prints blank line before printing the answer.

Code: Select all

int xo[1000], yo[1000], xt[1000], yt[1000], maxi, N,e=1;
..
if (e)cout << endl;
cout << maxi;
e = 1;
Also you should print a newline after the answer.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 10102 getting Wrong Answer , please help me to solve it

Post by lighted » Thu Mar 16, 2017 9:34 am

If you assume that square field can have size 1000x1000, then you should also assume that number of cells with color 1 or color 3 can be at most 999999. But your arrays xo, yo, xt, yt have size only 1000. You should get RE in this case, but not always. Sometimes you get WA. I checked that size of 4000 is enough for this problem's input.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

Post Reply

Return to “Volume 101 (10100-10199)”

Who is online

Users browsing this forum: No registered users and 1 guest