# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
129409 | 2019-07-12T08:03:36 Z | neki | Cloud Computing (CEOI18_clo) | C++14 | 88 ms | 1760 KB |
#include <bits/stdc++.h> #define maxn 2010 #define loop(i, a, b) for(int i=a;i<b;i++) #define cc(a) cout<< a << endl; using namespace std; long long inf=LONG_LONG_MIN/2; struct event{ int co, f, val; }; long long max(long long a, long long b){return (a>b) ? a:b;} bool cmp(event a, event b){ if(a.f>b.f) return true; if(a.f==b.f) return (a.co<b.co); return false; } event es[2* maxn]; int main() { int n;cin >> n; loop(i, 0, n){ scanf("%d%d%d", &es[i].co, &es[i].f, &es[i].val); es[i].val*=-1; } int m;cin >> m; loop(i, n, n+m){ scanf("%d%d%d", &es[i].co, &es[i].f, &es[i].val); es[i].co*=-1; } sort(es, es+n+m, cmp); vector<long long> dp={0}; long long ans=0; loop(i, 0, n+m){ auto dp2=dp; if(dp.size()<dp.size()+es[i].co) dp2.resize(dp.size()+es[i].co, inf); loop(j, 0, dp.size()){ if(j+es[i].co>=0) dp2[j+es[i].co]=max(dp2[j+es[i].co],dp[j]+es[i].val); } dp=dp2; } loop(i, 0, dp.size()) ans=max(ans, dp[i]); cc(ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 396 KB | Output is correct |
2 | Runtime error | 5 ms | 632 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 252 KB | Output is correct |
5 | Correct | 88 ms | 1760 KB | Output is correct |
6 | Runtime error | 5 ms | 632 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Halted | 0 ms | 0 KB | - |
# | 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 | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 400 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Runtime error | 4 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 396 KB | Output is correct |
2 | Runtime error | 5 ms | 632 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |