# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1088442 | 2024-09-14T11:52:23 Z | Sunbae | Palembang Bridges (APIO15_bridge) | C++17 | 32 ms | 3432 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; int a[200000]; signed main(){ int k, n, m = 0; scanf("%d %d", &k, &n); ll tot = 0, s[2] = {0, 0}; for(int i = 0; i<n; ++i){ char c[2]; int p[2]; scanf(" %c %d %c %d", c, p, c+1, p+1); if(c[0] == c[1]) tot += abs(p[0]-p[1]); else {a[m++] = p[0]; a[m++] = p[1];} } sort(a, a+m); for(int j = 0; j<2; ++j) for(int i = 0; i<m; ++i) s[j] += abs(a[i] - a[m/2 - j]); printf("%lld", tot + min(s[0], s[1]) + m/2); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 344 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 472 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 476 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 17 ms | 1884 KB | Output is correct |
13 | Correct | 32 ms | 3408 KB | Output is correct |
14 | Correct | 23 ms | 2136 KB | Output is correct |
15 | Correct | 19 ms | 2140 KB | Output is correct |
16 | Correct | 20 ms | 2652 KB | Output is correct |
17 | Correct | 22 ms | 3420 KB | Output is correct |
18 | Correct | 27 ms | 3124 KB | Output is correct |
19 | Correct | 30 ms | 3432 KB | Output is correct |
20 | Correct | 22 ms | 2908 KB | Output is correct |
21 | Correct | 28 ms | 3160 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 452 KB | Output is correct |
3 | Incorrect | 0 ms | 348 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 0 ms | 348 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 0 ms | 348 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |