# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
167752 | 2019-12-10T03:36:26 Z | daniyar03 | Divide and conquer (IZhO14_divide) | C++14 | 1000 ms | 3320 KB |
#include<bits/stdc++.h> #define int long long int using namespace std; struct data{ int x,g,d; }; bool cmp(data l,data r){ return l.x<r.x||l.x==r.x&&l.d>r.d||l.x==r.x&&l.d==r.d&&l.g>r.g; } data a[100001]; int n,i,l,r,gold[100001],drive[100001],mx,m,j; main(){ scanf("%lld",&n); for(i=1;i<=n;i++)scanf("%lld%lld%lld",&a[i].x,&a[i].g,&a[i].d); sort(a+1,a+1+n,cmp); for(i=1;i<=n;i++)gold[i]=gold[i-1]+a[i].g,drive[i]=drive[i-1]+a[i].d; for(i=1;i<=n;i++) for(j=i;j<=n;j++){ if(drive[j]-drive[i-1]>=a[j].x-a[i].x)mx=max(mx,gold[j]-gold[i-1]); } cout<<mx; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 380 KB | Output is correct |
7 | Correct | 2 ms | 248 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 4 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 4 ms | 376 KB | Output is correct |
10 | Correct | 5 ms | 504 KB | Output is correct |
11 | Correct | 18 ms | 632 KB | Output is correct |
12 | Correct | 17 ms | 668 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 632 KB | Output is correct |
2 | Correct | 86 ms | 888 KB | Output is correct |
3 | Correct | 88 ms | 952 KB | Output is correct |
4 | Execution timed out | 1074 ms | 3320 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |