結果

問題 No.178 美しいWhitespace (1)
ユーザー rocoderrocoder
提出日時 2017-06-10 04:56:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 397 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 11,836 KB
実行使用メモリ 10,316 KB
最終ジャッジ日時 2023-10-24 06:14:16
合計ジャッジ時間 2,281 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,144 KB
testcase_01 AC 28 ms
10,144 KB
testcase_02 AC 27 ms
10,144 KB
testcase_03 AC 27 ms
10,144 KB
testcase_04 AC 31 ms
10,316 KB
testcase_05 AC 32 ms
10,316 KB
testcase_06 AC 35 ms
10,316 KB
testcase_07 AC 31 ms
10,316 KB
testcase_08 AC 31 ms
10,316 KB
testcase_09 AC 32 ms
10,316 KB
testcase_10 AC 31 ms
10,316 KB
testcase_11 AC 31 ms
10,316 KB
testcase_12 AC 30 ms
10,316 KB
testcase_13 AC 33 ms
10,316 KB
testcase_14 AC 32 ms
10,316 KB
testcase_15 AC 34 ms
10,316 KB
testcase_16 AC 34 ms
10,316 KB
testcase_17 AC 32 ms
10,316 KB
testcase_18 AC 31 ms
10,316 KB
testcase_19 AC 32 ms
10,316 KB
testcase_20 AC 30 ms
10,316 KB
testcase_21 AC 32 ms
10,316 KB
testcase_22 AC 32 ms
10,240 KB
testcase_23 AC 32 ms
10,312 KB
testcase_24 AC 33 ms
10,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int (input())
A=[[int (i) for i in input ().split()]for i in range (N)]
nd=0
A[0][1]=A[0][1]*4
A[0][0]+=A[0][1]
M=A[0][0]
i=1
while nd==0 and i<N:
    A[i][1]=A[i][1]*4
    A[i][0]+=A[i][1]
    d=A[i][0]-A[i-1][0]
    if d%2!=0:
        nd=1
        print (-1)
    if M<A[i][0]:
        M=A[i][0]
    i+=1
if nd==0:
    di=0
    for i in range(N):
        di+=M-A[i][0]
    di//=2
    print (di)
0