# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
43381 | 2018-03-15T08:32:13 Z | top34051 | Palembang Bridges (APIO15_bridge) | C++14 | 72 ms | 18664 KB |
#include<bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int n,k,sz; int pos[maxn]; int main() { long long ans = 0; scanf("%d%d",&k,&n); for(int i=1;i<=n;i++) { int x, y; char t1, t2; scanf(" %c%d %c%d",&t1,&x,&t2,&y); if(t1==t2) ans += abs(y-x); else { pos[sz++] = x; pos[sz++] = y; ans++; } } sort(&pos[0],&pos[sz]); int opt = pos[sz/2]; // printf("opt %d\n",opt); for(int i=0;i<sz;i++) ans += abs(opt-pos[i]); printf("%lld",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 1 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 580 KB | Output is correct |
4 | Correct | 2 ms | 580 KB | Output is correct |
5 | Correct | 2 ms | 580 KB | Output is correct |
6 | Correct | 2 ms | 580 KB | Output is correct |
7 | Correct | 2 ms | 580 KB | Output is correct |
8 | Correct | 2 ms | 656 KB | Output is correct |
9 | Correct | 2 ms | 656 KB | Output is correct |
10 | Correct | 2 ms | 656 KB | Output is correct |
11 | Correct | 2 ms | 656 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 656 KB | Output is correct |
2 | Correct | 1 ms | 656 KB | Output is correct |
3 | Correct | 2 ms | 656 KB | Output is correct |
4 | Correct | 2 ms | 656 KB | Output is correct |
5 | Correct | 2 ms | 656 KB | Output is correct |
6 | Correct | 2 ms | 656 KB | Output is correct |
7 | Correct | 2 ms | 656 KB | Output is correct |
8 | Correct | 3 ms | 656 KB | Output is correct |
9 | Correct | 3 ms | 656 KB | Output is correct |
10 | Correct | 2 ms | 656 KB | Output is correct |
11 | Correct | 2 ms | 656 KB | Output is correct |
12 | Correct | 52 ms | 1388 KB | Output is correct |
13 | Correct | 69 ms | 4116 KB | Output is correct |
14 | Correct | 55 ms | 4928 KB | Output is correct |
15 | Correct | 40 ms | 6172 KB | Output is correct |
16 | Correct | 36 ms | 8084 KB | Output is correct |
17 | Correct | 72 ms | 10404 KB | Output is correct |
18 | Correct | 59 ms | 12360 KB | Output is correct |
19 | Correct | 59 ms | 14688 KB | Output is correct |
20 | Correct | 50 ms | 16652 KB | Output is correct |
21 | Correct | 61 ms | 18664 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 18664 KB | Output is correct |
2 | Correct | 2 ms | 18664 KB | Output is correct |
3 | Incorrect | 1 ms | 18664 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 18664 KB | Output is correct |
2 | Correct | 2 ms | 18664 KB | Output is correct |
3 | Incorrect | 2 ms | 18664 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 18664 KB | Output is correct |
2 | Correct | 2 ms | 18664 KB | Output is correct |
3 | Incorrect | 2 ms | 18664 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |