# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
167813 | 2019-12-10T09:26:18 Z | juggernaut | Divide and conquer (IZhO14_divide) | C++14 | 50 ms | 2680 KB |
#include<bits/stdc++.h> #define int long long int using namespace std; struct data{ int x,g,d; }; data a[100001]; int n,i,l,r,x,g,mx,d; main(){ scanf("%lld",&n); for(i=1;i<=n;i++)scanf("%lld%lld%lld",&a[i].x,&a[i].g,&a[i].d); l=r=1; x=a[1].x; g=a[1].g; d=a[1].d; while(r<=n&&l<=n){ if(r<n&&d+a[r+1].d>=a[r+1].x-x){ r++; d+=a[r].d; g+=a[r].g; mx=max(mx,g); }else{ g-=a[l].g; d-=a[l].d; l++; x=a[l].x; } } printf("%lld",mx); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Incorrect | 2 ms | 376 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 508 KB | Output is correct |
3 | Correct | 6 ms | 504 KB | Output is correct |
4 | Correct | 21 ms | 1532 KB | Output is correct |
5 | Correct | 25 ms | 1528 KB | Output is correct |
6 | Correct | 50 ms | 2680 KB | Output is correct |
7 | Correct | 36 ms | 2680 KB | Output is correct |
8 | Correct | 37 ms | 2680 KB | Output is correct |
9 | Correct | 35 ms | 2680 KB | Output is correct |
10 | Incorrect | 36 ms | 2680 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |