# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
38731 | 2018-01-06T10:47:33 Z | oTTo_22 | Fireworks (APIO16_fireworks) | C++14 | 0 ms | 2180 KB |
#include <bits/stdc++.h> #define se second #define fi first #define ll long long using namespace std; vector < vector < pair < ll,ll > > > g; int main () { ios_base::sync_with_stdio(false); cin.tie(0); ll n,m; cin >> n >> m; vector < ll > c; g.resize(n+m+1); for (int i=2; i<=n+m; i++) { ll p; ll cc; cin >> p >> cc; c.push_back(cc); g[i].push_back({p,cc}); g[p].push_back({i,cc}); } sort (c.begin(),c.end()); if (n==1) { ll p=c[(c.size()-1)/2]; ll ans=0; for (int i=0; i<c.size(); i++) ans=ans+abs(p-c[i]); cout << ans; return 0; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2180 KB | Output is correct |
2 | Correct | 0 ms | 2180 KB | Output is correct |
3 | Correct | 0 ms | 2180 KB | Output is correct |
4 | Correct | 0 ms | 2180 KB | Output is correct |
5 | Correct | 0 ms | 2180 KB | Output is correct |
6 | Correct | 0 ms | 2180 KB | Output is correct |
7 | Correct | 0 ms | 2180 KB | Output is correct |
8 | Correct | 0 ms | 2180 KB | Output is correct |
9 | Correct | 0 ms | 2180 KB | Output is correct |
10 | Correct | 0 ms | 2180 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2180 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2180 KB | Output is correct |
2 | Correct | 0 ms | 2180 KB | Output is correct |
3 | Correct | 0 ms | 2180 KB | Output is correct |
4 | Correct | 0 ms | 2180 KB | Output is correct |
5 | Correct | 0 ms | 2180 KB | Output is correct |
6 | Correct | 0 ms | 2180 KB | Output is correct |
7 | Correct | 0 ms | 2180 KB | Output is correct |
8 | Correct | 0 ms | 2180 KB | Output is correct |
9 | Correct | 0 ms | 2180 KB | Output is correct |
10 | Correct | 0 ms | 2180 KB | Output is correct |
11 | Incorrect | 0 ms | 2180 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2180 KB | Output is correct |
2 | Correct | 0 ms | 2180 KB | Output is correct |
3 | Correct | 0 ms | 2180 KB | Output is correct |
4 | Correct | 0 ms | 2180 KB | Output is correct |
5 | Correct | 0 ms | 2180 KB | Output is correct |
6 | Correct | 0 ms | 2180 KB | Output is correct |
7 | Correct | 0 ms | 2180 KB | Output is correct |
8 | Correct | 0 ms | 2180 KB | Output is correct |
9 | Correct | 0 ms | 2180 KB | Output is correct |
10 | Correct | 0 ms | 2180 KB | Output is correct |
11 | Incorrect | 0 ms | 2180 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |