# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
38727 | 2018-01-06T10:44:33 Z | Waschbar | Fireworks (APIO16_fireworks) | C++14 | 3 ms | 13736 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 300000; long long N, n, m, ans; long long 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 < long long > vv; for(int i = 2; i <= N; i++) vv.push_back(dis[i]); sort(vv.begin(),vv.end()); long long 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 13736 KB | Output is correct |
2 | Correct | 0 ms | 13736 KB | Output is correct |
3 | Correct | 0 ms | 13736 KB | Output is correct |
4 | Correct | 3 ms | 13736 KB | Output is correct |
5 | Correct | 3 ms | 13736 KB | Output is correct |
6 | Correct | 0 ms | 13736 KB | Output is correct |
7 | Correct | 0 ms | 13736 KB | Output is correct |
8 | Correct | 0 ms | 13736 KB | Output is correct |
9 | Correct | 0 ms | 13736 KB | Output is correct |
10 | Correct | 0 ms | 13736 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 13736 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 13736 KB | Output is correct |
2 | Correct | 0 ms | 13736 KB | Output is correct |
3 | Correct | 0 ms | 13736 KB | Output is correct |
4 | Correct | 3 ms | 13736 KB | Output is correct |
5 | Correct | 3 ms | 13736 KB | Output is correct |
6 | Correct | 0 ms | 13736 KB | Output is correct |
7 | Correct | 0 ms | 13736 KB | Output is correct |
8 | Correct | 0 ms | 13736 KB | Output is correct |
9 | Correct | 0 ms | 13736 KB | Output is correct |
10 | Correct | 0 ms | 13736 KB | Output is correct |
11 | Incorrect | 3 ms | 13736 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 13736 KB | Output is correct |
2 | Correct | 0 ms | 13736 KB | Output is correct |
3 | Correct | 0 ms | 13736 KB | Output is correct |
4 | Correct | 3 ms | 13736 KB | Output is correct |
5 | Correct | 3 ms | 13736 KB | Output is correct |
6 | Correct | 0 ms | 13736 KB | Output is correct |
7 | Correct | 0 ms | 13736 KB | Output is correct |
8 | Correct | 0 ms | 13736 KB | Output is correct |
9 | Correct | 0 ms | 13736 KB | Output is correct |
10 | Correct | 0 ms | 13736 KB | Output is correct |
11 | Incorrect | 3 ms | 13736 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |