結果
問題 |
No.2315 Flying Camera
|
ユーザー |
|
提出日時 | 2023-05-30 16:44:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 414 bytes |
コンパイル時間 | 1,822 ms |
コンパイル使用メモリ | 197,380 KB |
最終ジャッジ日時 | 2025-02-13 16:33:09 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(void){ 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 x = X[n/2], y = Y[n/2]; int sum = 0; for (int i = 0; i < n; i++) { sum += abs(X[i]-x) + abs(Y[i] - y); } cout << sum << endl; }