結果

問題 No.178 美しいWhitespace (1)
ユーザー hiragn
提出日時 2019-07-19 04:38:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 536 bytes
コンパイル時間 1,532 ms
コンパイル使用メモリ 168,388 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-25 23:55:51
合計ジャッジ時間 2,776 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 7 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin >> n;

    vector<int> vt(n);
    for (int i = 0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        vt[i] = a + 4 * b;
    }

    int wsMax = *std::max_element(vt.begin(), vt.end());
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if ((wsMax - vt[i]) % 2 != 0) {
            cout << -1 << endl;
            return 0;
        } else {
            ans += (wsMax - vt[i]) / 2;
        }
    }

    cout << ans << endl;
    return 0;
}
0