結果

問題 No.451 575
ユーザー butter_rollbutter_roll
提出日時 2016-12-11 23:20:16
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 461 bytes
コンパイル時間 2,348 ms
コンパイル使用メモリ 61,544 KB
実行使用メモリ 4,932 KB
最終ジャッジ日時 2023-08-22 13:34:49
合計ジャッジ時間 4,455 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 4 ms
4,376 KB
testcase_06 AC 9 ms
4,380 KB
testcase_07 AC 65 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 195 ms
4,932 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 3 ms
4,376 KB
testcase_16 AC 12 ms
4,376 KB
testcase_17 AC 64 ms
4,376 KB
testcase_18 AC 64 ms
4,464 KB
testcase_19 AC 42 ms
4,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
4,380 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 8 ms
4,376 KB
testcase_30 AC 63 ms
4,376 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 15 ms
4,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