Submission #38731

#TimeUsernameProblemLanguageResultExecution timeMemory
38731oTTo_22Fireworks (APIO16_fireworks)C++14
7 / 100
0 ms2180 KiB
#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 (stderr)

fireworks.cpp: In function 'int main()':
fireworks.cpp:34:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i=0; i<c.size(); i++)
                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...