結果

問題 No.2315 Flying Camera
ユーザー tatyam
提出日時 2023-03-02 14:01:03
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 467 bytes
コンパイル時間 2,920 ms
コンパイル使用メモリ 251,500 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-17 09:27:48
合計ジャッジ時間 3,942 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> X(N), Y(N);
    for(int i = 0; i < N; i++) {
        cin >> X[i] >> Y[i];
    }
    sort(X.begin(), X.end());
    sort(Y.begin(), Y.end());
    
    int ans = 0;
    for(int i = 0; i < N / 2; i++) {
        ans += X.rbegin()[i] - X[i];
        ans += Y.rbegin()[i] - Y[i];
    }
    cout << ans << endl;
}
0