Submission #916756

#TimeUsernameProblemLanguageResultExecution timeMemory
916756irmuunFireworks (APIO16_fireworks)C++17
7 / 100
1 ms460 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n,m; cin>>n>>m; ll p[n+m+5],c[n+m+5]; for(ll i=1;i<n+m;i++){ cin>>p[i]>>c[i]; } if(n==1){ sort(c+1,c+n+m); ll x=(n+m)/2; ll ans=0; for(ll i=1;i<n+m;i++){ ans+=abs(c[i]-c[x]); } cout<<ans<<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...