# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
170735 | 2019-12-26T08:49:27 Z | juggernaut | 금 캐기 (IZhO14_divide) | C++14 | 1000 ms | 3704 KB |
//Just try and the idea will come! #include<bits/stdc++.h> #define int long long int using namespace std; struct data{ int x,g,d; }; data a[100001]; int n,i,drive[100001],gold[100001],vec[100001],res,j; main(){ scanf("%lld",&n); for(i=1;i<=n;i++){ scanf("%lld%lld%lld",&a[i].x,&a[i].g,&a[i].d); gold[i]=gold[i-1]+a[i].g; drive[i]=drive[i-1]+a[i].d; vec[i]=drive[i]-a[i].x; } for(i=1;i<=n;i++){ for(j=i;j<=n;j++){ if(vec[j]>=drive[i-1]-a[i].x)res=max(res,gold[j]-gold[i-1]); } } cout<<res; }
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 | 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 | 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 | 3 ms | 504 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 504 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 504 KB | Output is correct |
10 | Correct | 5 ms | 504 KB | Output is correct |
11 | Correct | 16 ms | 632 KB | Output is correct |
12 | Correct | 16 ms | 632 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 632 KB | Output is correct |
2 | Correct | 52 ms | 1012 KB | Output is correct |
3 | Correct | 53 ms | 1076 KB | Output is correct |
4 | Execution timed out | 1086 ms | 3704 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |