結果

問題 No.340 雪の足跡
ユーザー YasukeXXXYasukeXXX
提出日時 2016-02-11 00:15:43
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,034 bytes
コンパイル時間 590 ms
コンパイル使用メモリ 23,308 KB
実行使用メモリ 18,372 KB
最終ジャッジ日時 2023-10-21 22:38:35
合計ジャッジ時間 5,070 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,348 KB
testcase_01 AC 0 ms
4,348 KB
testcase_02 AC 0 ms
4,348 KB
testcase_03 AC 0 ms
4,348 KB
testcase_04 AC 0 ms
4,348 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 0 ms
4,348 KB
testcase_09 AC 0 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | w,h,n,m,ld,min;
      | ^
main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘w’ [-Wimplicit-int]
main.c:1:3: warning: type defaults to ‘int’ in declaration of ‘h’ [-Wimplicit-int]
    1 | w,h,n,m,ld,min;
      |   ^
main.c:1:5: warning: type defaults to ‘int’ in declaration of ‘n’ [-Wimplicit-int]
    1 | w,h,n,m,ld,min;
      |     ^
main.c:1:7: warning: type defaults to ‘int’ in declaration of ‘m’ [-Wimplicit-int]
    1 | w,h,n,m,ld,min;
      |       ^
main.c:1:9: warning: type defaults to ‘int’ in declaration of ‘ld’ [-Wimplicit-int]
    1 | w,h,n,m,ld,min;
      |         ^~
main.c:1:12: warning: type defaults to ‘int’ in declaration of ‘min’ [-Wimplicit-int]
    1 | w,h,n,m,ld,min;
      |            ^~~
main.c:9:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    9 | main(){
      | ^~~~
main.c: In function ‘main’:
main.c:10:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
   10 |         scanf("%d%d%d",&w,&h,&n);
      |         ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | w,h,n,m,ld,min;
main.c:10:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
   10 |         scanf("%d%d%d",&w,&h,&n);
      |         ^~~~~
main.c:10:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:26:40: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
   26 |                 if((w+h-2<=d)&&(f==1)){printf("%d",d);return 0;}}
      |                                        ^~~~~~
main.c:26:40: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:26:40: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
main.c

ソースコード

diff #

w,h,n,m,ld,min;
void dot(int list[w*h][w*h], int H[w*h][w*h]){
	int tmp[w*h][w*h],ans=0;
	for(int i=0;i<w*h;i++){for(int j=0;j<w*h;j++){tmp[i][j]=list[i][j];}}
	for(int i=0;i<w*h;i++){for(int j=0;j<w*h;j++){
		for(int k=0;k<w*h;k++){ans+=tmp[i][k]*H[k][j];}
		list[i][j]=ans;
		ans=0;}}}
main(){
	scanf("%d%d%d",&w,&h,&n);
	int H[w*h][w*h],d=1;
	for(int i=0;i<w*h;i++){for(int j=0;j<w*h;j++){H[i][j]=0;}}
	for(int i=0;i<n;i++){scanf("%d",&m);int tmp[m+1];
		for(int j=0;j<m+1;j++){scanf("%d",tmp+j);}
		for(int j=0;j<m;j++){
			ld=tmp[j]>tmp[j+1]?(tmp[j]-tmp[j+1]):(tmp[j+1]-tmp[j]);
			min=tmp[j]>tmp[j+1]?tmp[j+1]:tmp[j];
			for(int k=0;k<ld/w;k++){
				H[min+k*w][min+(k+1)*w]=1;H[min+(k+1)*w][min+k*w]=1;}
			if(ld/w==0){for(int k=0;k<ld;k++){
				H[min+k][min+(k+1)]=1;H[min+(k+1)][min+k]=1;}}}}
	int H_org[w*h][w*h],f=0;
	for(int i=0;i<w*h;i++){for(int j=0;j<w*h;j++){H_org[i][j]=H[i][j];}}
	while(w*h-d){dot(H,H_org);d++;
		if(H[0][w*h-1]!=0)f=1;
		if((w+h-2<=d)&&(f==1)){printf("%d",d);return 0;}}
	puts("Odekakedekinai..");}
0