結果
問題 | No.2315 Flying Camera |
ユーザー |
|
提出日時 | 2023-06-02 21:06:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 401 bytes |
コンパイル時間 | 796 ms |
コンパイル使用メモリ | 74,340 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-28 15:55:25 |
合計ジャッジ時間 | 1,629 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { 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; ++i) { ans += abs(x[i] - x[n / 2]); ans += abs(y[i] - y[n / 2]); } cout << ans << '\n'; }