結果

問題 No.451 575
ユーザー rlangevinrlangevin
提出日時 2023-09-15 12:25:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 601 bytes
コンパイル時間 2,081 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 82,920 KB
最終ジャッジ日時 2023-09-15 12:25:35
合計ジャッジ時間 9,120 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,100 KB
testcase_01 AC 72 ms
71,168 KB
testcase_02 AC 71 ms
71,096 KB
testcase_03 AC 76 ms
71,472 KB
testcase_04 AC 72 ms
71,164 KB
testcase_05 AC 89 ms
76,200 KB
testcase_06 AC 85 ms
76,452 KB
testcase_07 AC 138 ms
82,920 KB
testcase_08 AC 73 ms
71,456 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 167 ms
77,820 KB
testcase_14 AC 73 ms
71,200 KB
testcase_15 AC 84 ms
76,528 KB
testcase_16 AC 87 ms
76,224 KB
testcase_17 AC 112 ms
77,624 KB
testcase_18 AC 110 ms
77,524 KB
testcase_19 AC 99 ms
77,544 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 72 ms
71,456 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 71 ms
71,232 KB
testcase_26 AC 78 ms
71,264 KB
testcase_27 AC 72 ms
71,264 KB
testcase_28 AC 74 ms
71,248 KB
testcase_29 AC 84 ms
76,232 KB
testcase_30 AC 110 ms
77,624 KB
testcase_31 AC 70 ms
71,104 KB
testcase_32 AC 102 ms
78,900 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 + 1)

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