# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
168012 | 2019-12-11T07:25:33 Z | GioChkhaidze | 금 캐기 (IZhO14_divide) | C++14 | 55 ms | 5288 KB |
#include <bits/stdc++.h> #define ll long long using namespace std; const int N=1e5+5; ll n,x[N],g[N],d[N],M[N],ans; main () { scanf("%lld",&n); for (int i=1; i<=n; i++) { scanf("%lld%lld%lld",&x[i],&g[i],&d[i]); g[i]+=g[i-1]; d[i]+=d[i-1]; M[i]=d[i]-x[i]; } M[n+1]=-1e18; for (int i=n; i>=1; i--) M[i]=max(M[i],M[i+1]); for (int i=1; i<=n; i++) { ll c=d[i-1]-x[i],l=i,r=n,mid,res; while (l<=r) { mid=(l+r)/2; if (c<=M[mid]) { res=mid; l=mid+1; } else r=mid-1; } ans=max(ans,g[res]-g[i-1]); } printf("%lld\n",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 396 KB | Output is correct |
7 | Correct | 2 ms | 376 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 |
# | 결과 | 실행 시간 | 메모리 | 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 | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 3 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 4 ms | 632 KB | Output is correct |
12 | Correct | 4 ms | 632 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 508 KB | Output is correct |
2 | Correct | 5 ms | 760 KB | Output is correct |
3 | Correct | 6 ms | 888 KB | Output is correct |
4 | Correct | 23 ms | 2936 KB | Output is correct |
5 | Correct | 27 ms | 3192 KB | Output is correct |
6 | Correct | 55 ms | 4984 KB | Output is correct |
7 | Correct | 41 ms | 4856 KB | Output is correct |
8 | Correct | 41 ms | 4848 KB | Output is correct |
9 | Correct | 39 ms | 4984 KB | Output is correct |
10 | Correct | 40 ms | 4984 KB | Output is correct |
11 | Correct | 46 ms | 5288 KB | Output is correct |
12 | Correct | 48 ms | 5240 KB | Output is correct |