sry…got it AC…was using int intead of long…-_-…realised after “long” time…
Can somebody please look and tell why i am getting Run-time error for my solution:
https://www.codechef.com/viewsolution/10734413
Thanks in advance.
Hi,
My below code is getting WA.
https://www.codechef.com/viewsolution/10818504
If possible let me know in which test cases it might fail.
The test cases i tried in which it is giving correct answer-
2
1 12
2 1
(op- 12
12
13)
5
2 1
2 2
2 3
2 4
2 5
(op-0
5
5
9
9
12
12
14
14
15)
5
1 1
1 2
1 3
1 4
1 5
(op-5
9
12
14
15)
5
1 34
2 4
1 2
2 0
2 22
(op-34
36
56
58
60
62
62
62)
4
1 4
2 4
1 5
2 5
(op-5
9
10
14
14
18)
Hi Everyone.
I have used different approach but it runs slow.
Sort values and increase value at each iteration uptill capacity is M as per
- current max value of wt 1 or
- current max value of wt 2 - min value of wt 1 which are added added
or - none and we shall add wt 2 at next one or
- current max value of wt 2 if prev executed
Time complexity is only O(NlogN).
I have got correct answer but it runs very slow :(. It runs in 0.56 seconds. :(.
This problem was easy so upper time bound was not quite tight but I am planning to tackle harder than these. Many of you are already masters in those and thus I am confident that you can help me.
It would be immensely kind of you folks if you could give a little of our valuable time to tell me how to optimize it.
Please, any help is greatly appreciated.
Thanks for sparing some time and reading this.