結果

問題 No.178 美しいWhitespace (1)
ユーザー gon_027
提出日時 2020-01-02 13:38:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 537 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 67,708 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-22 18:00:28
合計ジャッジ時間 1,530 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 5 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

int s[1010];
int t[1010];

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

    int tmax = 0;
    int ans = -1;

    for(int i = 0; i < n; ++i){
        int a, b;
        cin >> a >> b;
        s[i] = a;
        t[i] = b;

        int x = a + b * 4;
        tmax = std::max(tmax, x);
    }

    int sum = 0;
    for(int i = 0; i < n; ++i){
        int x = tmax - (s[i] + t[i] * 4);
        sum += x;
    }

    if(sum % 2 == 0){
        ans = sum / 2;
    }

    cout << ans << endl;
}
0