after seeing this editorial, i feel stupid. good question setter. thumps up for u
changed. thanks
s = raw_input().strip() workedâŚwhats the use of strip()??
But the question says " It is guaranteed that there will be no whitespaces before or after Operator."??
Such problems are so necessary to remind us that cases determination is an important part however easy the problem be ⌠good thinking âŚ
@sobhagya - thanks for input⌠but could not get your point. if I am continuing to next test case when k==0 by simply printing the given âansâ and not reading the array/operator, then why should it at all give âTime Limit Exceedâ problem. in fact for k==0, this reduces the task of reading the array unnecessarily⌠would you mind explaining a bit ?
@sayantancs Try this input:
2
5 0 1
1000000000 2 3 4 5
XOR
2 2 2
3 3
AND
If you do not care to read off the array in the first test case, then you take the value of n for the second test case as 10^9, k as 2 and ans as 3, and proceed with a loop that runs 10^9 times to read the array that actually does not exist.
I think, now, what @sobhagya tried to say has become clear.
The point is, you need to simply read the array off, to get to the next input. (This is necessary!!)
I too got frustrated for not handling k==0 case.
I got 2 WA for that.
gets is deprecated. You shave have taken input by
scanf("%s", str);
Can someone tell me the problem in this solution:
http://www.codechef.com/viewsolution/2727952
Been stuck for too long.
Tried removing one getchar() but that didnât work either.
last reply to this topic was over 9 years ago. Your reply will bump the topic to the top of its list and notify anyone previously involved in the conversation.
Are you sure you want to continue this old conversat