結果

問題 No.451 575
ユーザー tnodinotnodino
提出日時 2023-07-09 18:59:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 650 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 23,032 KB
最終ジャッジ日時 2023-09-30 22:34:03
合計ジャッジ時間 6,420 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,184 KB
testcase_01 AC 16 ms
8,304 KB
testcase_02 AC 15 ms
7,780 KB
testcase_03 AC 16 ms
8,248 KB
testcase_04 AC 16 ms
7,820 KB
testcase_05 AC 30 ms
8,932 KB
testcase_06 AC 62 ms
10,776 KB
testcase_07 AC 261 ms
23,032 KB
testcase_08 AC 16 ms
8,116 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 340 ms
20,168 KB
testcase_14 AC 16 ms
7,884 KB
testcase_15 AC 24 ms
8,556 KB
testcase_16 AC 55 ms
9,972 KB
testcase_17 AC 255 ms
20,160 KB
testcase_18 AC 259 ms
20,584 KB
testcase_19 AC 176 ms
16,524 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 16 ms
8,308 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 16 ms
8,288 KB
testcase_26 AC 16 ms
7,772 KB
testcase_27 AC 17 ms
7,776 KB
testcase_28 AC 19 ms
8,336 KB
testcase_29 AC 41 ms
9,400 KB
testcase_30 AC 265 ms
21,160 KB
testcase_31 AC 15 ms
7,764 KB
testcase_32 AC 99 ms
13,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
b = list(int(input()) for _ in range(n))
a1 = [1]
for i in range(n):
    if i % 2 == 0:
        a1.append(b[i] - a1[-1])
    else:
        a1.append(a1[-1] - b[i])
a2 = [b[0] - 1]
for i in range(n):
    if i % 2 == 0:
        a2.append(b[i] - a2[-1])
    else:
        a2.append(a2[-1] - b[i])
flg = True
for i in range(n+1):
    if a1[i] <= 0:
        flg = False
        break
if flg:
    print(n+1)
    for i in range(n+1):
        print(a1[i])
    exit()
flg = True
for i in range(n+1):
    if a2[i] <= 0:
        flg = False
        break
if flg:
    print(n+1)
    for i in range(n+1):
        print(a2[i])
    exit()
print(-1)
0