結果

問題 No.178 美しいWhitespace (1)
ユーザー suibaka_ku
提出日時 2017-03-12 07:27:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 588 bytes
コンパイル時間 758 ms
コンパイル使用メモリ 82,284 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-25 02:42:41
合計ジャッジ時間 1,798 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 7 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    vector<int> v(N);
    int ma = 0;
    for(int i=0; i<N; ++i) {
        int a, b;
        cin >> a >> b;
        v[i] = a + 4*b;
        ma = max(ma, v[i]);
    }
    int res = 0;
    for(int i=0; i<N; ++i) {
        if((ma - v[i]) % 2 != 0) {
            res = -1;
            break;
        } else {
            res += (ma-v[i])/2;
        }
    }
    cout << res << endl;
}
0