結果

問題 No.451 575
コンテスト
ユーザー hanorver
提出日時 2016-12-02 10:24:27
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 272 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 56 ms
コンパイル使用メモリ 14,976 KB
実行使用メモリ 18,944 KB
最終ジャッジ日時 2026-10-04 12:44:30
合計ジャッジ時間 9,457 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13 WA * 7 TLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n=int(input())
b=[int(input()) for _ in range(n)]
i=m=0
a=[1]*(n+1)
while i<n:
 if i%2:a[i+1]=a[i]-b[i]
 else:a[i+1]=b[i]-a[i]
 if a[i+1]<=0:a[0]=-a[i+1]+1;i=-1;m+=1
 if m==1000:print(-1);exit()
 i+=1
if a[0]<=0:print(-1);exit()
print(n+1)
for _ in range(n+1):print(a[_])
0