Submission #203918

#TimeUsernameProblemLanguageResultExecution timeMemory
203918SegtreeFireworks (APIO16_fireworks)C++14
7 / 100
5 ms376 KiB
#include<iostream> #include<algorithm> #include<vector> using namespace std; typedef long long ll; #define chmin(a,b) a=min(a,b) #define chmax(a,b) a=max(a,b) #define rep(i,n) for(int i=0;i<n;i++) #define mod 1000000007 #define mad(a,b) a=(a+b)%mod int main(){ ll n,m; cin>>n>>m; if(n==1){ vector<ll> v; rep(i,m){ ll p,c; cin>>p>>c; v.push_back(c); } sort(v.begin(),v.end()); ll mid=v[m/2]; ll ans=0; rep(i,m)ans+=abs(v[i]-mid); cout<<ans<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...