結果

問題 No.451 575
ユーザー butsurizukibutsurizuki
提出日時 2016-12-02 18:35:14
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 656 bytes
コンパイル時間 950 ms
コンパイル使用メモリ 24,208 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-22 13:37:58
合計ジャッジ時間 3,968 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<stdio.h>
#define K 5000000000000000000

void prans(long long x,long long y[],long long z){
	long long i;
	printf("%lld\n",x);
	for(i = 1;i <= x;i++){
		if(i%4 < 2){
			printf("%lld\n",y[i]+z);
		}
		else{
			printf("%lld\n",y[i]-z);
		}
	}
}

int main(void){
	long long n,s,i,a[131072],pmin=1,mmin=K,t;
	scanf("%lld",&n);
	a[1] = 1;
	for(i = 1;i <= n;i++){
		scanf("%lld",&s);
		if(i%2){a[i+1] = s - a[i];}else{a[i+1] = a[i] - s;}
		if((i+1)%4 < 2){if(a[i+1] < pmin){pmin = a[i+1];}}else{if(a[i+1] < mmin){mmin = a[i+1];}}
	}
	if(mmin < 1){printf("-1\n");return 0;}
	if(mmin-1 < 1-pmin){printf("-1\n");return 0;}
	prans(n+1,a,1-pmin);
	return 0;
}
0