結果

問題 No.178 美しいWhitespace (1)
ユーザー Hachimori
提出日時 2015-04-05 23:25:43
言語 Python2
(2.7.18)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 476 bytes
コンパイル時間 50 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-07-04 02:09:18
合計ジャッジ時間 1,079 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
#coding:utf8


def read():
    N = input()
    ret = []
    for i in range(N):
        ret.append(map(int, raw_input().split()))
    return ret


def work(ABList):
    vList = [A + B * 4 for (A, B) in ABList]

    maxV = max(vList)

    ans = 0
    for (A, B) in ABList:
        if (maxV - (A + B * 4)) % 2 != 0:
            print -1
            return
        ans += (maxV - (A + B * 4)) / 2

    print ans


if __name__ == "__main__":
    work(read())
0