結果
| 問題 |
No.451 575
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2023-08-02 03:19:12 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 604 bytes |
| コンパイル時間 | 339 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 25,648 KB |
| 最終ジャッジ日時 | 2024-10-11 22:30:13 |
| 合計ジャッジ時間 | 8,231 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 3 |
| other | AC * 28 RE * 1 |
ソースコード
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=[max(1,-min(PLUS)+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)
titia