結果
| 問題 | 
                            No.178 美しいWhitespace (1)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             hamray
                         | 
                    
| 提出日時 | 2017-12-01 16:36:04 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 594 bytes | 
| コンパイル時間 | 657 ms | 
| コンパイル使用メモリ | 76,388 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-27 21:29:14 | 
| 合計ジャッジ時間 | 1,760 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 WA * 1 | 
| other | AC * 1 WA * 20 | 
ソースコード
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<set>
#include<iomanip>
#include<algorithm>
using namespace std;
int main() {
    int N; cin >> N;
    int a, b; 
    vector<int> v;
    int maxV = 0;
    for(int i=0; i<N; i++){
        cin >> a >> b;
        v.push_back(a + b * 4);
        maxV = max(maxV, v[i]);
    }
    int ans = 0;
    bool f = true;
    if(maxV < 2){
        f = false;
    }else{
        for(int i=0; i<N; i++){
            ans += (maxV - v[i]) / 2;
        }
    }
    if(f) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}
            
            
            
        
            
hamray