Submission #1125293

#TimeUsernameProblemLanguageResultExecution timeMemory
1125293Tyx2019Coin Collecting (JOI19_ho_t4)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h> #define int long long #define INF 1e18 using namespace std; main(){ int N; cin >> N; int X[2*N], Y[2*N]; for(int i=0;i<2*N;i++) cin >> X[i] >> Y[i]; sort(X, X+(2*N)); sort(Y, Y+(2*N)); int ans = 0; for(int i=1;i<=2*N;i++){ //cout << ((i + 1) / 2) << " " << ((i + N - 1) / N) << '\n'; ans += abs(X[i-1] - ((i + 1) / 2)); ans += abs(Y[i-1] - ((i + N - 1) / N)); } cout << ans; } /* 5 min: Q1 AC */

Compilation message (stderr)

joi2019_ho_t4.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...