# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
100572 | 2019-03-12T10:57:53 Z | Extazy | Palembang Bridges (APIO15_bridge) | C++17 | 53 ms | 3452 KB |
#include <bits/stdc++.h> #define endl '\n' using namespace std; const int N = 200007; int n, k, arr[N], sz; long long ans, offset; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int i, x, y; char tmp1[4], tmp2[4]; scanf("%d %d", &k, &n); for(i=1;i<=n;i++) { scanf("%s %d %s %d", tmp1, &x, tmp2, &y); if(tmp1[0]==tmp2[0]) offset += abs(x - y); else { arr[++sz] = x; arr[++sz] = y; ++offset; } } sort(arr + 1, arr + 1 + sz); if(k==1) { ans = offset; for(i=1;i<=sz;i++) { ans += abs(arr[i] - arr[(sz + 1) / 2]); } } else { } printf("%lld\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 356 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 400 KB | Output is correct |
12 | Correct | 27 ms | 1920 KB | Output is correct |
13 | Correct | 53 ms | 3452 KB | Output is correct |
14 | Correct | 37 ms | 2304 KB | Output is correct |
15 | Correct | 34 ms | 2180 KB | Output is correct |
16 | Correct | 31 ms | 2680 KB | Output is correct |
17 | Correct | 39 ms | 3420 KB | Output is correct |
18 | Correct | 45 ms | 3064 KB | Output is correct |
19 | Correct | 52 ms | 3448 KB | Output is correct |
20 | Correct | 38 ms | 2936 KB | Output is correct |
21 | Correct | 50 ms | 3324 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |