結果

問題 No.451 575
ユーザー 夜
提出日時 2020-11-20 01:37:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 896 bytes
コンパイル時間 2,136 ms
コンパイル使用メモリ 91,168 KB
実行使用メモリ 5,232 KB
最終ジャッジ日時 2023-09-30 18:16:15
合計ジャッジ時間 9,787 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 10 ms
4,376 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 196 ms
4,952 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 65 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
4,380 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 15 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long a[100010];
long long b[100010];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i += 2) {
		if (a[i] < 2) {
			cout << "-1" << endl;
			return 0;
		}
		if (a[i] - a[i + 1] < 2) {
			cout << "-1" << endl;
			return 0;
		}
	}
	cout << n + 1 << endl;
	cout << "1" << endl;
	b[0] = 1;
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			cout << a[i] - b[i] << endl;
			b[i + 1] = a[i] - b[i];
		}
		else {
			cout << b[i] - a[i] << endl;
			b[i + 1] = b[i] - a[i];
		}
	}
	return 0;
}
0