結果

問題 No.178 美しいWhitespace (1)
ユーザー Mao-betaMao-beta
提出日時 2024-04-01 19:41:58
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 853 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 65,852 KB
最終ジャッジ日時 2024-04-01 19:42:01
合計ジャッジ時間 2,768 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,624 KB
testcase_01 AC 44 ms
55,624 KB
testcase_02 AC 44 ms
55,624 KB
testcase_03 AC 44 ms
55,624 KB
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 MLE -
testcase_22 MLE -
testcase_23 MLE -
testcase_24 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
import bisect
from heapq import heapify, heappop, heappush
from collections import deque, defaultdict, Counter
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD99 = 998244353

input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()
SMI = lambda: input().split()
SLI = lambda: list(SMI())
EI = lambda m: [NLI() for _ in range(m)]


def main():
    N = NI()
    AB = EI(N)
    m = 0
    R = set()
    t = 0
    for a, b in AB:
        l = a + 4*b
        t += l
        m = max(m, l)
        R.add(l % 2)
    if len(R) >= 2:
        print(-1)
        return
    print((m*N - t) // 2)


if __name__ == "__main__":
    main()
0