Submission #1125385

#TimeUsernameProblemLanguageResultExecution timeMemory
1125385rotatedCoin Collecting (JOI19_ho_t4)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { int n; cin >> n; pair<int,int> c[2*n]; for (int i = 0; i < 2*n; i++) { cin >> c[i].first >> c[i].second; } sort(c, c + 2*n); int ans = 0; for (int i = 0; i < n; i++) { if (c[2*i].second >= 2) ans=ans+abs(c[2*i].first-(i+1))+abs(c[2*i].second-2)+abs(c[2*i+1].first-(i+1))+abs(c[2*i+1].second-1); else ans=ans+abs(c[2*i].first-(i+1))+abs(c[2*i].second-1)+abs(c[2*i+1].first-(i+1))+abs(c[2*i+1].second-2); } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...