# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1088442 | Sunbae | Palembang Bridges (APIO15_bridge) | C++17 | 32 ms | 3432 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |