| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 967193 | ByeWorld | Palembang Bridges (APIO15_bridge) | C++14 | 85 ms | 4636 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define pb push_back
#define fi first
#define se second
using namespace std;
const int MAXN = 2e5+10;
const int INF = 1e18+10;
typedef pair<int,int> pii;
typedef pair<int,pii> ipii;
int K, n;
int ans;
vector <int> vec;
int pr[MAXN];
signed main(){
// ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> K >> n;
vec.pb(-1);
for(int i=1; i<=n; i++){
char x, y; int a, b;
cin >> x >> a >> y >> b; a++; b++;
if(x==y) ans += abs(a-b);
else {
vec.pb(a); vec.pb(b);
}
}
sort(vec.begin(), vec.end());
int MN = INF, siz = vec.size()-1;
for(int i=1; i<=vec.size()-1; i++){
ans += abs(vec[(siz+1)/2]-vec[i]);
}
ans += siz/2;
cout << ans << '\n';
}
컴파일 시 표준 에러 (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... | ||||
