結果

問題 No.451 575
ユーザー くれちーくれちー
提出日時 2016-12-02 00:49:03
言語 C90
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 655 bytes
コンパイル時間 655 ms
コンパイル使用メモリ 24,348 KB
実行使用メモリ 6,708 KB
最終ジャッジ日時 2023-08-22 12:06:16
合計ジャッジ時間 8,946 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 1 ms
4,380 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 33 ms
6,708 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 1 ms
4,380 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 1 ms
4,380 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 6 ms
5,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <assert.h>

int main() {
	const long long max = 1000000000000000000;

	int n;
	scanf("%d", &n);

	static long long b[500000];
	int flag = 0;
	int i;

	for (i = 0; i < n; i++) {
		scanf("%lld", &b[i]);
		if (i % 2 == 1 && b[i] == max) flag = 1;
		else if (i % 2 == 0 && b[i] == 1) flag = 1;
	}
	if (flag) {
		puts("-1");
		return 0;
	}

	printf("%d\n", n + 1);

	static long long ans[500001];
	ans[0] = 1;
	
	for (i = 1; i < n + 1; i++) {
		if (i % 2 == 1) ans[i] = b[i - 1] - ans[i - 1];
		else ans[i] = ans[i - 1] - b[i - 1];
		assert(ans[i] > 0);
	}

	for (i = 0; i < n + 1; i++) {
		printf("%lld\n", ans[i]);
	}
	return 0;
}
0