| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 673556 | Cookie | Palembang Bridges (APIO15_bridge) | C++14 | 1 ms | 328 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#pragma GCC target("popcnt")
using namespace std;
#define ll long long
#define vt vector
#define pb push_back
#define fi first
#define se second
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
typedef unsigned long long ull;
#include<fstream>
ifstream fin("cowpatibility.in");
ofstream fout("cowpatibility.out");
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll mod = 1e9 + 7, p = 1299709, mod2 = 1e9 + 9;
const int mxn = 1e5;
int k, n;
ll ans = 0;
vt<pll>v;
void solve1(){
vt<ll>points;
for(auto [aa, bb]: v){
points.pb(aa); points.pb(bb);
}
sort(points.begin(), points.end());
int med = points[points.size() / 2];
for(int i = 0; i < points.size(); i++){
ans += abs(med - points[i]);
}
cout << ans;
}
void solve2(){
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> k >> n;
forr(i, 0, n){
char a, b; int aa, bb;
cin >> a >> aa >> b >> bb;
if(a == b)ans += abs(aa - bb);
v.pb({aa, bb});
}
if(k == 1)solve1();
else solve2();
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... | ||||
