Submission #170404

#TimeUsernameProblemLanguageResultExecution timeMemory
170404combi1k1Coin Collecting (JOI19_ho_t4)C++14
0 / 100
2 ms376 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define X first #define Y second #define all(x) x.begin(),x.end() #define sz(x) (int)x.size() #define pb emplace_back int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> row; vector<int> col; for(int i = 0 ; i < n + n ; ++i) { int x; cin >> x; int y; cin >> y; row.pb(x); col.pb(y); } sort(row.begin(),row.end()); sort(col.begin(),col.end()); ll ans = 0; for(int i = 0 ; i < n + n ; ++i) ans += abs(row[i] - 1 - (i / 2)); for(int i = 0 ; i < n + n ; ++i) ans += abs(col[i] - 2 + (i < n)); cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...