結果
問題 | No.2315 Flying Camera |
ユーザー | Yaowei Lyu |
提出日時 | 2023-05-26 21:24:23 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 478 bytes |
コンパイル時間 | 3,901 ms |
コンパイル使用メモリ | 250,124 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-25 04:34:26 |
合計ジャッジ時間 | 3,956 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; using i64 = int64_t; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; i += 1) { cin >> a[i] >> b[i]; } auto f = [&](vector<int> a) { sort(a.begin(), a.end()); int res = 0; for (int ai : a) { res += abs(ai - a[n / 2]); } return res; }; cout << f(a) + f(b); }