結果

問題 No.451 575
ユーザー ei1333333
提出日時 2016-12-02 00:39:14
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 1,504 ms
コンパイル使用メモリ 158,056 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-16 07:58:13
合計ジャッジ時間 5,031 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

typedef long long int64;

int main()
{
  int N;
  int64 B[100000];

  cin >> N;

  int64 xs = 1;
  for(int i = 0; i < N; i++) {
    cin >> B[i];
    if(i & 1) xs = xs - B[i];
    else xs = B[i] - xs;
    if(xs <= 0) {
      cout << -1 << endl;
      return (0);
    }
  }

  cout << N + 1 << endl;
  int64 rev = 1;
  cout << rev << endl;
  for(int i = 0; i < N; i++) {
    if(i & 1) rev = rev - B[i];
    else rev = B[i] - rev;
    cout << rev << endl;
  }
}
0