# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
14451 | 2015-05-17T07:01:08 Z | dohyun0324 | Palembang Bridges (APIO15_bridge) | C++ | 76 ms | 2680 KB |
#include<stdio.h> #include<algorithm> using namespace std; char c1,c2; long long dap; int w2,k,n,x1,x2,w,arr[200010]; struct data{ int x,y; bool operator<(const data&r)const{ return (x+y)<r.x+r.y; } }a[100010]; int main() { int i; scanf("%d %d",&k,&n); for(i=1;i<=n;i++) { scanf(" %c %d %c %d",&c1,&x1,&c2,&x2); if(c1==c2) dap+=abs(x2-x1); else{w++; a[w].x=x1; a[w].y=x2; arr[++w2]=x1; arr[++w2]=x2;} } sort(a+1,a+w+1); sort(arr+1,arr+w2+1); if(k==1) { for(i=1;i<=w2;i++) dap+=abs(arr[i]-arr[w]); } else { } printf("%lld",dap+w); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2680 KB | Output is correct |
2 | Correct | 0 ms | 2680 KB | Output is correct |
3 | Correct | 0 ms | 2680 KB | Output is correct |
4 | Correct | 0 ms | 2680 KB | Output is correct |
5 | Correct | 0 ms | 2680 KB | Output is correct |
6 | Correct | 0 ms | 2680 KB | Output is correct |
7 | Correct | 0 ms | 2680 KB | Output is correct |
8 | Correct | 0 ms | 2680 KB | Output is correct |
9 | Correct | 0 ms | 2680 KB | Output is correct |
10 | Correct | 0 ms | 2680 KB | Output is correct |
11 | Correct | 0 ms | 2680 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2680 KB | Output is correct |
2 | Correct | 0 ms | 2680 KB | Output is correct |
3 | Correct | 0 ms | 2680 KB | Output is correct |
4 | Correct | 0 ms | 2680 KB | Output is correct |
5 | Correct | 0 ms | 2680 KB | Output is correct |
6 | Correct | 0 ms | 2680 KB | Output is correct |
7 | Correct | 0 ms | 2680 KB | Output is correct |
8 | Correct | 0 ms | 2680 KB | Output is correct |
9 | Correct | 0 ms | 2680 KB | Output is correct |
10 | Correct | 0 ms | 2680 KB | Output is correct |
11 | Correct | 0 ms | 2680 KB | Output is correct |
12 | Correct | 33 ms | 2680 KB | Output is correct |
13 | Correct | 69 ms | 2680 KB | Output is correct |
14 | Correct | 56 ms | 2680 KB | Output is correct |
15 | Correct | 39 ms | 2680 KB | Output is correct |
16 | Correct | 39 ms | 2680 KB | Output is correct |
17 | Correct | 49 ms | 2680 KB | Output is correct |
18 | Correct | 56 ms | 2680 KB | Output is correct |
19 | Correct | 76 ms | 2680 KB | Output is correct |
20 | Correct | 53 ms | 2680 KB | Output is correct |
21 | Correct | 66 ms | 2680 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2680 KB | Output is correct |
2 | Correct | 0 ms | 2680 KB | Output is correct |
3 | Incorrect | 0 ms | 2680 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2680 KB | Output is correct |
2 | Correct | 0 ms | 2680 KB | Output is correct |
3 | Incorrect | 0 ms | 2680 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2680 KB | Output is correct |
2 | Correct | 0 ms | 2680 KB | Output is correct |
3 | Incorrect | 0 ms | 2680 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |