結果
問題 | No.451 575 |
ユーザー |
![]() |
提出日時 | 2016-12-11 23:20:16 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 461 bytes |
コンパイル時間 | 688 ms |
コンパイル使用メモリ | 59,240 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-16 11:01:05 |
合計ジャッジ時間 | 4,650 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 WA * 8 |
ソースコード
#include <cstdio>#include <algorithm>#include <iostream>#include <vector>#define ll long long intusing namespace std;int main(void){ll n;ll a[111111],b[111111];int i;cin>>n;for(i=1;i<=n;i++){cin>>b[i];}a[1]=1;for(i=2;i<=n+1;i++){a[i]=(i%2)?(a[i-1]-b[i-1]):(b[i-1]-a[i-1]);if(a[i]<=0){cout<<"-1\n";return 0;}}cout<<n+1<<endl;for(i=1;i<=n+1;i++){cout<<a[i]<<endl;}return 0;}