結果

問題 No.178 美しいWhitespace (1)
ユーザー kutsutama
提出日時 2019-01-28 17:49:16
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-05 03:27:47
合計ジャッジ時間 1,892 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
width = [0] * n
even = False
odd = False
for i in range(n):
    a, b = [int(x) for x in input().split()]
    width[i] = a + 4 * b
    if a % 2 == 0:
        even = True
    else:
        odd = True

res = 0
if even and odd:
    res = -1
else:
    len_max = max(width)
    for w in width:
        res += len_max - w
    res //= 2

print(res)
0