結果

問題 No.178 美しいWhitespace (1)
ユーザー utsumidaisuke
提出日時 2018-12-20 23:58:00
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 121 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-25 09:14:43
合計ジャッジ時間 1,958 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

ls = []
for i in range(n):
    a,b = map(int, input().split())
    sm = a+4*b
    ls.append(sm)

oe = []
for i in ls:
    if i%2 == 0:
        oe.append(0)
    else:
        oe.append(1)

if len(set(oe)) == 2:
    print('-1')
else:
    total = 0
    mx = max(ls)
    for i in ls:
        total += mx - i 
    print(int(total/2))
0