結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
8,696 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 0 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 0 ms
4,348 KB
testcase_05 AC 0 ms
4,348 KB
testcase_06 AC 0 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 0 ms
4,348 KB
testcase_10 AC 3 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: In function ‘main’:
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d%d%d",&w,&h,&n);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:15:26: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         for(i=0;i<n;i++){scanf("%d",&m);int tmp[m+1];
      |                          ^~~~~~~~~~~~~~
main.c:16:36: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |                 for(j=0;j<m+1;j++){scanf("%d",tmp+j);}
      |                                    ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int w,h,n,m,ld,min,i,j,k;
void dot(int list[w*h][w*h], int H[w*h][w*h]){
	int tmp[w*h][w*h],ans=0;
	for(i=0;i<w*h;i++){for(j=0;j<w*h;j++){tmp[i][j]=list[i][j];}}
	for(i=0;i<w*h;i++){for(j=0;j<w*h;j++){
		for(k=0;k<w*h;k++){ans+=tmp[i][k]*H[k][j];}
		list[i][j]=ans;
		ans=0;}}}
int main(){
	scanf("%d%d%d",&w,&h,&n);
	if(w==1 && h==1){puts("0");return 0;}
	int H[w*h][w*h],d=1;
	for(i=0;i<w*h;i++){for(j=0;j<w*h;j++){H[i][j]=0;}}
	for(i=0;i<n;i++){scanf("%d",&m);int tmp[m+1];
		for(j=0;j<m+1;j++){scanf("%d",tmp+j);}
		for(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(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(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];
	for(i=0;i<w*h;i++){for(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]){printf("%d",d);return 0;}}
	puts("Odekakedekinai..");return 0;}
0