제출 #1125311

#제출 시각아이디문제언어결과실행 시간메모리
1125311PwoCoin Collecting (JOI19_ho_t4)C++17
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int n; int a[100005], b[100005]; int32_t main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n; for (int i = 0; i < n + n; i++) cin >> a[i] >> b[i]; sort(a, a + n + n); sort(b, b + n + n); int ans = 0; for (int i = 0; i < n + n; i++) { ans += abs(a[i] - (i / 2 + 1)); ans += abs(b[i] - (i / n + 1)); } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...