# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
340618 | 2020-12-28T03:00:32 Z | beksultan04 | 금 캐기 (IZhO14_divide) | C++14 | 1000 ms | 2560 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define OK puts("OK"); #define NO puts("NO"); #define YES puts("YES"); #define fr first #define sc second #define ret return #define scanl(a) scanf("%lld",&a); #define scanll(a,b) scanf("%lld %lld",&a, &b); #define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c); #define scan1(a) scanf("%d",&a); #define scan2(a,b) scanf("%d %d",&a, &b); #define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c); #define all(s) s.begin(),s.end() #define allr(s) s.rbegin(),s.rend() #define pb push_back #define sz(v) (int)v.size() #define endi puts(""); #define eps 1e-12 const int N = 1e6+12,INF=1e9+7; ll q[N],x[N],g[N],d[N]; main(){ int n,m,i,j; ll ans=0; scan1(n) for (i=1;i<=n;++i){ scanlll(x[i],g[i],d[i]) } for (i=1;i<=n;++i){ ll e=d[i],sum=g[i]; ans = max(ans,sum); for (j=i+1;j<=n;++j){ e += d[j]; sum += g[j]; if (e >= x[j]-x[i]){ ans = max(ans,sum); } } } cout <<ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 2 ms | 492 KB | Output is correct |
19 | Correct | 2 ms | 364 KB | Output is correct |
20 | Correct | 2 ms | 364 KB | Output is correct |
21 | Correct | 2 ms | 364 KB | Output is correct |
22 | Correct | 3 ms | 364 KB | Output is correct |
23 | Correct | 14 ms | 620 KB | Output is correct |
24 | Correct | 14 ms | 620 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 2 ms | 492 KB | Output is correct |
19 | Correct | 2 ms | 364 KB | Output is correct |
20 | Correct | 2 ms | 364 KB | Output is correct |
21 | Correct | 2 ms | 364 KB | Output is correct |
22 | Correct | 3 ms | 364 KB | Output is correct |
23 | Correct | 14 ms | 620 KB | Output is correct |
24 | Correct | 14 ms | 620 KB | Output is correct |
25 | Correct | 17 ms | 492 KB | Output is correct |
26 | Correct | 67 ms | 748 KB | Output is correct |
27 | Correct | 66 ms | 876 KB | Output is correct |
28 | Execution timed out | 1082 ms | 2560 KB | Time limit exceeded |
29 | Halted | 0 ms | 0 KB | - |