結果

問題 No.451 575
ユーザー YamyukiYamyuki
提出日時 2016-12-02 12:40:42
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 21,504 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-09 18:43:13
合計ジャッジ時間 4,617 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 AC 0 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 20 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 4 ms
5,376 KB
testcase_17 AC 21 ms
5,376 KB
testcase_18 AC 20 ms
5,376 KB
testcase_19 AC 14 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 3 ms
5,376 KB
testcase_30 AC 20 ms
5,376 KB
testcase_31 WA -
testcase_32 AC 6 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:44:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   44 |         scanf("%ld",&n);
      |         ^~~~~~~~~~~~~~~
main.c:46:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   46 |                 scanf("%lld",&a[i]);
      |                 ^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

long long a[100000],b[100001];
long n;

long long set(long c){
	int f;
	if(c==n+1) return 0;
	if(c==0){
  	long long f;
    f=1;
    b[0]=0;
    while(f>0){
      b[0]+=f;
      f=set(1);
    }
    if (f==0) return 1;
		return 0;
	}
	if(c%2==1){
    f=a[c-1]-b[c-1];
		if(f>0){
			b[c]=f;
			f=set(c+1);
			if(f==0) return 0;
      return f;
		}
    if(c%4==3) return (-1*f)+1;
    return f;
	}
  f=b[c-1]-a[c-1];
	if(f>0){
		b[c]=f;
    f=set(c+1);
    if(f==0) return 0;
    return f;
	}
  if(c%4==2) return (-1*f)+1;
	return f;
}

int main(){
	long i;
	scanf("%ld",&n);
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	if(set(0)){
		printf("%ld\n",n+1);
		for(i=0;i<n+1;i++){
			printf("%lld\n",b[i]);
		}
		return 0;
	}
	printf("-1\n");
  return 0;
}
0