結果

問題 No.451 575
ユーザー titiatitia
提出日時 2023-08-02 03:13:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 586 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 25,728 KB
最終ジャッジ日時 2024-04-20 03:30:45
合計ジャッジ時間 6,876 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 28 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 44 ms
11,520 KB
testcase_06 AC 85 ms
13,440 KB
testcase_07 AC 321 ms
25,728 KB
testcase_08 AC 28 ms
10,752 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 391 ms
22,644 KB
testcase_14 AC 28 ms
10,752 KB
testcase_15 AC 37 ms
11,264 KB
testcase_16 AC 75 ms
12,800 KB
testcase_17 AC 321 ms
22,784 KB
testcase_18 AC 333 ms
22,640 KB
testcase_19 AC 213 ms
18,816 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 28 ms
10,752 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 32 ms
10,752 KB
testcase_26 AC 26 ms
10,752 KB
testcase_27 AC 27 ms
10,752 KB
testcase_28 AC 29 ms
10,880 KB
testcase_29 AC 56 ms
12,032 KB
testcase_30 AC 337 ms
24,064 KB
testcase_31 AC 29 ms
10,752 KB
testcase_32 AC 132 ms
15,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
B=[int(input()) for i in range(n)]

MINUS=[]
PLUS=[]

c=0
now=0

for i in range(n):
    if c==0 or c==1:
        if c==0:
            now=-now+B[i]
        else:
            now-=B[i]
        MINUS.append(now)
        
    else:
        if c==2:
            now=-now+B[i]
        else:
            now-=B[i]
        PLUS.append(now)
        

    c+=1
    c%=4

ANS=[1]
for i in range(n):
    if i%2==0:
        ANS.append(B[i]-ANS[-1])
    else:
        ANS.append(ANS[-1]-B[i])

if min(ANS)<=0:
    print(-1)
else:
    print(n+1)
    for ans in ANS:
        print(ans)
0