結果

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

ソースコード

diff #

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

long s[1010];
long t[1010];

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

    long tmax = 0;
    long ans = -1;

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

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

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

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

    cout << ans << endl;
}
0