# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
38726 | 2018-01-06T10:43:36 Z | Waschbar | Fireworks (APIO16_fireworks) | C++14 | 6 ms | 11392 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 300000; int N, n, m, ans; int dis[MAXN+1], pr[MAXN+1]; vector < vector < int > > g(MAXN+1); int main() { cin >> n >> m; N = n+m; for(int i = 2; i <= N; i++) { cin >> pr[i] >> dis[i]; g[pr[i]].push_back(i); g[i].push_back(pr[i]); } if(n == 1) { vector < int > vv; for(int i = 2; i <= N; i++) vv.push_back(dis[i]); sort(vv.begin(),vv.end()); int xx = vv[vv.size()/2]; for(int i = 0; i < vv.size(); i++) ans += abs(vv[i]-xx); cout << ans; return 0; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 11392 KB | Output is correct |
2 | Correct | 3 ms | 11392 KB | Output is correct |
3 | Incorrect | 3 ms | 11392 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 11392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 11392 KB | Output is correct |
2 | Correct | 3 ms | 11392 KB | Output is correct |
3 | Incorrect | 3 ms | 11392 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 11392 KB | Output is correct |
2 | Correct | 3 ms | 11392 KB | Output is correct |
3 | Incorrect | 3 ms | 11392 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |