Search found 5 matches

by robinpahwa
Fri May 09, 2014 8:59 am
Forum: Volume 4 (400-499)
Topic: 497 - Strategic Defense Initiative
Replies: 144
Views: 20942

Re: 497 - Strategic Defense Initiative (Weird WA)

brianfry713 wrote:Look at the output at https://ideone.com/sbz6py
There are only 19 values.
How did you see that :o
Many thanks, it is now accepted :)
by robinpahwa
Thu May 08, 2014 9:50 pm
Forum: Volume 4 (400-499)
Topic: 497 - Strategic Defense Initiative
Replies: 144
Views: 20942

Re: 497 - Strategic Defense Initiative (Weird WA)

brianfry713 wrote: There may be other valid outputs for this input, but your code is only printing 19 values.
I am getting this on my machine. Please see here https://ideone.com/sbz6py

My output:

Code: Select all

Max hits: 21
33
43
84
107
113
164
288
317
380
420
445
489
493
523
554
592
620
653
871
877
910
by robinpahwa
Thu May 08, 2014 8:39 am
Forum: Volume 4 (400-499)
Topic: 497 - Strategic Defense Initiative
Replies: 144
Views: 20942

Re: 497 - Strategic Defense Initiative (Weird WA)

#include <cstdlib> input: 1 1 1 2 3 AC output: Max hits: 3 1 2 3 I have changed the code to handle this test case. I have already handled this before but got the WA so thought of handling 2 missiles at the same altitude, now I know it is wrong after reading this from the problem statement "once you...
by robinpahwa
Thu May 08, 2014 6:11 am
Forum: Volume 4 (400-499)
Topic: 497 - Strategic Defense Initiative
Replies: 144
Views: 20942

Re: 497 - Strategic Defense Initiative (Weird WA)

brianfry713 wrote:That code won't compile without the includes.
http://en.wikipedia.org/wiki/Longest_in ... ubsequence
Thanks for replying brianfry713, please see the updated code with includes in my original post.
by robinpahwa
Tue May 06, 2014 9:14 pm
Forum: Volume 4 (400-499)
Topic: 497 - Strategic Defense Initiative
Replies: 144
Views: 20942

497 - Strategic Defense Initiative (Weird WA)

I am getting a weird WA in this problem and I don't know what could be wrong. Can somebody please verify my 2 assumptions and look to my code below: 1. altitudes could have same values in the input set. 2. There could be blank lines in the input set Please suggest what could be wrong in this solutio...

Go to advanced search