結果

問題 No.178 美しいWhitespace (1)
ユーザー gorugo30
提出日時 2021-02-23 20:27:43
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-09-22 14:52:27
合計ジャッジ時間 1,822 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
ab = [list(map(int, input().split())) for i in range(N)]
W = [ab[i][0] + 4 * ab[i][1] for i in range(N)]
cnte = 0
cnto = 0
for i in range(N):
    if W[i] % 2:
        cnto += 1
    else:
        cnte += 1
if cnto * cnte > 0:
    print(-1)
    exit()
W.sort(reverse = True)
maxx = W[0]
ans = 0
for i in range(1, N):
    ans += (W[0] - W[i]) // 2
print(ans)
0