結果

問題 No.451 575
ユーザー butter_rollbutter_roll
提出日時 2016-12-11 23:20:16
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 461 bytes
コンパイル時間 724 ms
コンパイル使用メモリ 59,480 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-09 19:16:49
合計ジャッジ時間 3,657 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 4 ms
5,376 KB
testcase_06 AC 10 ms
5,376 KB
testcase_07 AC 60 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 176 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 4 ms
5,376 KB
testcase_16 AC 11 ms
5,376 KB
testcase_17 AC 58 ms
5,376 KB
testcase_18 AC 63 ms
5,376 KB
testcase_19 AC 39 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
5,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 8 ms
5,376 KB
testcase_30 AC 61 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 14 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#define ll long long int
using 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;
}
0