# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
298503 | 2020-09-13T03:30:26 Z | dakara2006 | 막대기 (KOI13_game) | C++ | 5 ms | 896 KB |
#include <bits/stdc++.h> using namespace std; pair <int,int> a[10005]; int main() { static int n,m,bmax[10005],tmax[10005],k; scanf("%d %d",&n,&m); for(int i=0;i<n;i++) { scanf("%d %d",&a[i].second,&a[i].first); } sort(a,a+n); for(int i=0;i<n;i++) { int p=bmax[a[i].first]; bmax[a[i].first] = max(bmax[a[i].first],tmax[a[i].second]+m+abs(a[i].first-a[i].second)); tmax[a[i].second] = max(tmax[a[i].second],p+m+abs(a[i].first-a[i].second)); k=max(k,max(bmax[a[i].first],tmax[a[i].second])); } printf("%d",k); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Runtime error | 1 ms | 512 KB | Execution killed with signal 11 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 896 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Runtime error | 1 ms | 384 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Runtime error | 1 ms | 512 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 768 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |