Submission #946574

#TimeUsernameProblemLanguageResultExecution timeMemory
946574simona1230Fireworks (APIO16_fireworks)C++17
7 / 100
2 ms5156 KiB
#include <bits/stdc++.h> using namespace std; int n,m; vector<pair<int,int> > v[200001]; vector<int> val; void read() { cin>>n>>m; for(int i=2;i<=n+m;i++) { int x,y; cin>>x>>y; val.push_back(y); v[i].push_back({x,y}); } if(n==1) { sort(val.begin(),val.end()); int sz=val.size(); long long need=val[sz/2],ans=0; for(int i=0;i<sz;i++) ans+=abs(val[i]-need); cout<<ans<<endl; exit(0); } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); read(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...