結果
| 問題 | 
                            No.2315 Flying Camera
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-06-01 14:55:47 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 751 bytes | 
| コンパイル時間 | 1,740 ms | 
| コンパイル使用メモリ | 170,976 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-12-28 14:58:21 | 
| 合計ジャッジ時間 | 2,785 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 4 WA * 20 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    for (auto &i : a)
        cin >> i.first >> i.second;
    vector<pair<int, int>> cd = {{0, 0}, {0, 0}};
    for (auto i : a)
    {
        cd[0].first += i.first;
        cd[0].second += i.second;
        cd[1].first += i.first;
        cd[1].second += i.second;
    }
    cd[0].first /= n;
    cd[0].second /= n;
    (cd[1].first += n - 1) /= n;
    (cd[1].second += n - 1) /= n;
    int s[2] = {0, 0};
    for (auto i : a)
    {
        s[0] += abs(cd[0].first - i.first) + abs(cd[0].second - i.second);
        s[1] += abs(cd[1].first - i.first) + abs(cd[1].second - i.second);
    }
    cout << min(s[0], s[1]) << endl;
}