# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
166388 | 2019-12-02T03:50:13 Z | abil | 금 캐기 (IZhO14_divide) | C++14 | 1000 ms | 3304 KB |
#include <bits/stdc++.h> #define fr first #define sc second #define pb push_back #define mk make_pair #define all(s) s.begin(),s.end() #define int long long using namespace std; const int N = (1e6 + 12); const int mod = (1e9 + 7); const int INF = (1e15 + 9); int x[N], g[N], c[N], pr[N], prg[N], mx[N]; vector<pair<int,int > > vec; main() { int n; scanf("%lld", &n); for(int i = 1;i <= n; i++){ scanf("%lld%lld%lld", &x[i], &g[i], &c[i]); pr[i] = pr[i - 1] + c[i]; vec.pb({x[i] - pr[i], i}); prg[i] = prg[i - 1] + g[i]; } sort(all(vec)); int ans = 0; for(int i = 1;i <= n; i++){ int p = i; for(int j = 0;j < vec.size(); j++){ if(vec[j].fr <= x[i] - pr[i] + 1){ p = max(p, vec[j].sc); } } ans = max(ans, prg[p] - prg[i - 1]); } cout << ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Incorrect | 2 ms | 504 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 768 KB | Output is correct |
2 | Correct | 97 ms | 1144 KB | Output is correct |
3 | Correct | 96 ms | 1144 KB | Output is correct |
4 | Execution timed out | 1048 ms | 3304 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |