Submission #748968

#TimeUsernameProblemLanguageResultExecution timeMemory
7489681075508020060209tcCoin Collecting (JOI19_ho_t4)C++14
0 / 100
1 ms308 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int n; int xar[500005]; int yar[500005]; signed main(){ cin>>n; for(int i=1;i<=n*2;i++){ cin>>xar[i]>>yar[i]; } sort(xar+1,xar+n+n+1); sort(yar+1,yar+n+n+1); int ans=0; for(int i=1;i<=n+n;i++){ int pl=(i+1)/2; ans+=abs(pl-xar[i]); } for(int i=1;i<=n;i++){ ans+=abs(yar[i]-1)+abs(yar[i+n]-2); } cout<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...