結果

問題 No.2315 Flying Camera
ユーザー hitonanode
提出日時 2023-05-27 23:40:38
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 1,552 ms
コンパイル使用メモリ 99,436 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 05:49:13
合計ジャッジ時間 1,891 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

long long solve(vector<int> X) {
    sort(X.begin(), X.end());
    int x = X.at(X.size() / 2);
    long long ret = 0;
    for (int y : X) ret += abs(x - y);
    return ret;
}
int main() {
    int N;
    cin >> N;
    vector<int> X(N), Y(N);
    for (int i = 0; i < N; ++i) cin >> X.at(i) >> Y.at(i);
    cout << solve(X) + solve(Y) << endl;
}
0