結果

問題 No.178 美しいWhitespace (1)
ユーザー gon_027gon_027
提出日時 2020-01-02 13:40:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 705 ms
コンパイル使用メモリ 68,088 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-02 06:27:42
合計ジャッジ時間 1,513 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 WA -
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 WA -
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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