結果

問題 No.451 575
ユーザー kimiyukikimiyuki
提出日時 2016-12-02 02:35:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 636 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 22,784 KB
最終ジャッジ日時 2024-05-09 18:24:07
合計ジャッジ時間 7,116 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,752 KB
testcase_01 AC 28 ms
10,624 KB
testcase_02 AC 26 ms
10,752 KB
testcase_03 AC 25 ms
10,752 KB
testcase_04 AC 27 ms
10,624 KB
testcase_05 AC 44 ms
11,264 KB
testcase_06 AC 92 ms
12,416 KB
testcase_07 AC 345 ms
20,096 KB
testcase_08 AC 27 ms
10,624 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 448 ms
22,784 KB
testcase_14 AC 27 ms
10,880 KB
testcase_15 AC 37 ms
10,880 KB
testcase_16 AC 77 ms
12,032 KB
testcase_17 AC 334 ms
18,560 KB
testcase_18 AC 341 ms
18,560 KB
testcase_19 AC 234 ms
15,872 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 25 ms
10,752 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 27 ms
10,624 KB
testcase_26 AC 27 ms
10,752 KB
testcase_27 AC 29 ms
10,624 KB
testcase_28 AC 31 ms
10,752 KB
testcase_29 AC 59 ms
11,392 KB
testcase_30 AC 343 ms
19,328 KB
testcase_31 AC 25 ms
10,624 KB
testcase_32 AC 134 ms
13,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
n = int(input())
b = [ int(input()) for _ in range(n) ]
def f(a1):
    a = [ None ] * (n+1)
    a[0] = a1
    for i in range(n):
        if (i+1 + 1) % 2 == 0:
            a[i+1] = - a[i] + b[i]
        else:
            a[i+1] = a[i] - b[i]
    return a
lower = 1
upper = 10*18
a = f(0)
for i in range(n+1):
    if ((i+1) // 2) % 2 == 0:
        lower = max(lower, 1      - a[i])
        upper = min(upper, 10**18 - a[i])
    else:
        lower = max(lower, a[i] - 10**18)
        upper = min(upper, a[i] - 1     )
if lower <= upper:
    print(n+1)
    for ai in f(lower):
        print(ai)
else:
    print(-1)
0