結果

問題 No.178 美しいWhitespace (1)
ユーザー togatogatogatoga
提出日時 2015-08-27 09:08:37
言語 Python2
(2.7.18)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 755 ms
コンパイル使用メモリ 6,696 KB
実行使用メモリ 6,268 KB
最終ジャッジ日時 2023-09-25 18:52:28
合計ジャッジ時間 2,527 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,108 KB
testcase_01 AC 11 ms
6,148 KB
testcase_02 AC 11 ms
6,108 KB
testcase_03 AC 11 ms
6,228 KB
testcase_04 AC 14 ms
5,988 KB
testcase_05 AC 14 ms
6,156 KB
testcase_06 AC 14 ms
6,188 KB
testcase_07 AC 14 ms
5,988 KB
testcase_08 AC 14 ms
6,108 KB
testcase_09 AC 14 ms
5,984 KB
testcase_10 AC 14 ms
6,084 KB
testcase_11 AC 14 ms
6,084 KB
testcase_12 AC 14 ms
6,084 KB
testcase_13 AC 14 ms
6,088 KB
testcase_14 AC 14 ms
6,020 KB
testcase_15 AC 15 ms
6,012 KB
testcase_16 AC 15 ms
6,220 KB
testcase_17 AC 14 ms
6,140 KB
testcase_18 AC 14 ms
5,988 KB
testcase_19 AC 15 ms
6,124 KB
testcase_20 AC 14 ms
6,024 KB
testcase_21 AC 15 ms
6,260 KB
testcase_22 AC 14 ms
6,108 KB
testcase_23 AC 14 ms
5,988 KB
testcase_24 AC 14 ms
6,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
N = input()
space_max = 0
d = [0] * (10**3)
for i in range(N):
    a,b = map(int, raw_input().split())
    d[i] = a + 4 * b
    space_max = max(space_max, a + 4 * b)
ans = 0
for i in range(N):
    rest = abs(space_max - d[i])
    if (rest % 2 != 0):
        print -1
        sys.exit()
    ans += (rest) / 2
print ans
0