結果

問題 No.451 575
ユーザー rlangevinrlangevin
提出日時 2023-09-15 12:20:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 597 bytes
コンパイル時間 1,198 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 82,944 KB
最終ジャッジ日時 2023-09-15 12:22:17
合計ジャッジ時間 8,731 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,500 KB
testcase_01 AC 72 ms
71,384 KB
testcase_02 AC 70 ms
71,472 KB
testcase_03 AC 72 ms
71,384 KB
testcase_04 AC 74 ms
71,316 KB
testcase_05 AC 83 ms
76,728 KB
testcase_06 AC 87 ms
76,472 KB
testcase_07 AC 142 ms
82,944 KB
testcase_08 AC 73 ms
71,216 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 139 ms
78,180 KB
testcase_14 AC 76 ms
70,980 KB
testcase_15 AC 87 ms
76,156 KB
testcase_16 AC 115 ms
76,348 KB
testcase_17 AC 110 ms
77,676 KB
testcase_18 AC 112 ms
77,556 KB
testcase_19 AC 102 ms
77,412 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 74 ms
71,276 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 70 ms
71,436 KB
testcase_26 AC 72 ms
71,084 KB
testcase_27 AC 78 ms
71,440 KB
testcase_28 AC 74 ms
71,244 KB
testcase_29 AC 86 ms
76,380 KB
testcase_30 AC 133 ms
77,492 KB
testcase_31 AC 74 ms
71,400 KB
testcase_32 AC 103 ms
79,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# a2 = b1 - a1
# a3 = a2 - b2 = - b2 + b1 - a1
# a4 = b3 - a3 = b3 + b2 - b1 + a1
# a5 = a4 - b4 = -b4 + b3 + b2 - b1 + a1
# a6 = b5 - a5

import sys
input = sys.stdin.readline

N = int(input())
ans = [0] * N
v = 0
now = 0
for i in range(N):
    b = int(input())
    if i % 2:
        now = now - b
    else:
        now = b - now
    ans[i] = now
    if i % 4 <= 1:
        v = min(v, now)

a = max(1, -v)
for i in range(N):
    if i % 4 <= 1:
        ans[i] -= a
    else:
        ans[i] += a
    if ans[i] <= 0:
        print(-1)
        exit()

print(N + 1)
print(a)
for a in ans:
    print(a)
0