結果

問題 No.340 雪の足跡
ユーザー YasukeXXXYasukeXXX
提出日時 2016-02-11 11:38:51
言語 C90
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 903 bytes
コンパイル時間 784 ms
コンパイル使用メモリ 23,248 KB
実行使用メモリ 5,828 KB
最終ジャッジ日時 2023-10-21 22:57:59
合計ジャッジ時間 5,184 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,348 KB
testcase_01 AC 0 ms
4,348 KB
testcase_02 AC 1 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 1 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 0 ms
4,348 KB
testcase_11 AC 81 ms
5,828 KB
testcase_12 TLE -
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:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d%d%d",&w,&h,&n);l=w*h;
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:14:26: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         for(i=0;i<n;i++){scanf("%d",&m);int tmp[m+1];
      |                          ^~~~~~~~~~~~~~
main.c:15:36: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |                 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,l;
void dot(int list[l], int H[l][l]){
	int tmp[l],ans=0;
	for(i=0;i<l;i++){tmp[i]=list[i];}
	for(i=0;i<l;i++){for(j=0;j<l;j++){ans+=tmp[j]*H[j][i];}
		list[i]=ans;
		ans=0;}}
int main(){
	scanf("%d%d%d",&w,&h,&n);l=w*h;
	if(l==1){puts("0");return 0;}
	int H[l][l],d=1;
	for(i=0;i<l;i++){for(j=0;j<l;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_dist[l];
	for(i=0;i<l;i++){H_dist[i]=H[0][i];}
	while(l-d){dot(H_dist,H);d++;
		if(H_dist[l-1]){printf("%d",d);return 0;}}
	puts("Odekakedekinai..");return 0;}
0