# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1027623 | KasymK | Fireworks (APIO16_fireworks) | C++17 | 1 ms | 2652 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
using namespace std;
#define ss second
#define ff first
#define ll long long
#define pb push_back
#define all(v) v.begin(), v.end()
#define pii pair<int, int>
const int N = 1e5+5;
vector<pii> adj[N];
int main(){
int n, m;
scanf("%d%d", &n, &m);
for(int i = 2; i <= n+m; ++i){
int a, b;
scanf("%d%d", &a, &b);
adj[a].pb({i,b});
}
auto cmp = [&](pii a, pii b) -> bool {
return a.ss < b.ss;
};
int x = 1;
sort(all(adj[x]), cmp);
int sz = (int)adj[x].size();
int ad = adj[x][sz/2].ss;
ll answer = 0;
for(auto i : adj[x])
answer += abs(ad-i.ss);
printf("%lld", answer);
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... |