| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 834964 | vjudge1 | Palembang Bridges (APIO15_bridge) | C++17 | 86 ms | 5964 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
const int nmax = 1e5+5;
struct abt {
char har;
int h;
char oar;
int o;
};
abt per[nmax];
int main() {
int K,N;
long long dist = 0;
cin >> K >> N;
vector<pair<int,int>>jar;
vector<int>dex;
for(int i=1; i<=N; i++) {
cin >> per[i].har >> per[i].h >> per[i].oar >> per[i].o;
if(per[i].har == per[i].oar) {
dist += abs(per[i].h - per[i].o);
} else {
jar.push_back({per[i].h, per[i].o});
dex.push_back(per[i].h);
dex.push_back(per[i].o);
}
}
int bridge;
if(jar.empty()) {
cout << dist << endl;
return 0;
}
sort(dex.begin(), dex.end());
int tengah = dex.size()/2;
int tng = dex[tengah];
for(int i=0; i<jar.size(); i++) {
dist += abs(jar[i].fi - tng) + abs(jar[i].se - tng);
}
dist += jar.size();
cout << dist << endl;
return 0;
}
컴파일 시 표준 에러 (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... | ||||
