Two similar codes (almost ), one getting RUNTIME error & the other got AC

runtime-error

#1

first i submitted using vector (i have done this earlier in other problems successfully :slight_smile: ) but got runtime error & same code i submitted using structure(everything was same except i stored the value in struct variable instead of vector ) & … got AC . lol !!

[http://www.codechef.com/viewsolution/3160692][1] (using vector)

[http://www.codechef.com/viewsolution/3160968][2] (using structure)

i’d appreciate if anyone willing to answer … :slight_smile:
[1]: http://www.codechef.com/viewsolution/3160692
[2]: http://www.codechef.com/viewsolution/3160968


#2

Is that a problem? I do not know…

int s=a[0].p; // AC

and

s=a[0][2]; // RE

try it…


#3

no that’s not…as a[0].p(in AC) represents the same thing as a[0][2] (in RE) …


#4

problem is maybe, that there is int missing in RE, not sure if macro is not applied, try it :wink:


#5

i declared int s already above(in RE ) … see yourself (line 120) :slight_smile:


#6

Hi Sagar, we’d suggest you to post your query on the editorial page of the problem. It will help you get over the query sooner.