結果

問題 No.178 美しいWhitespace (1)
ユーザー nCandy
提出日時 2018-10-14 10:41:58
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 501 ms
コンパイル使用メモリ 60,264 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-12 18:17:23
合計ジャッジ時間 1,195 ms
ジャッジサーバーID
(参考情報)
judge / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 7 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;

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