| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1343875 | Zero | Palembang Bridges (APIO15_bridge) | C++20 | 33 ms | 5264 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define ff first
#define ss second
#define pi pair<int,int>
signed main(){
cin.tie(0)->sync_with_stdio(0);
int k, n; cin >> k >> n;
vector<int> c;
vector<pair<char,int>> x,y;
int s = 0;
for(int i=0; i < n; i ++){
char a,b; int a1, b1; cin >> a >> a1 >> b >> b1;
if(a == b) s += abs(a1 - b1);
else {
c.pb(a1);c.pb(b1);
x.pb({a,a1});
y.pb({b,b1});
}
}
sort(c.begin(),c.end());
n = c.size()/2;
int xx = c[n];
for(int i=0; i < n; i ++){
s += abs(y[i].ss - xx) + abs(x[i].ss - xx) + 1;
}
cout << s;
}| # | 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... | ||||
