結果

問題 No.340 雪の足跡
ユーザー maimai
提出日時 2016-01-29 23:48:52
言語 C90
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 1,693 bytes
コンパイル時間 459 ms
コンパイル使用メモリ 22,460 KB
実行使用メモリ 813,028 KB
最終ジャッジ日時 2023-10-21 17:34:38
合計ジャッジ時間 3,161 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,348 KB
testcase_01 MLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
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:26:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
   26 | main(){
      | ^~~~
main.c: In function ‘main’:
main.c:30:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |     scanf("%d%d%d",&w,&h,&n);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:37:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   37 |         scanf("%d",&m);
      |         ^~~~~~~~~~~~~~
main.c:40:13: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   40 |             scanf("%d",&k);
      |             ^~~~~~~~~~~~~~

ソースコード

diff #

// ------------------------
// 無念(´・ω・`)
// ------------------------

#include <stdio.h>

    int map[1000][1000];
    int w,h,n;
    
int move(int x,int y){
    int r=0;
    if (x==w-1 && y==h-1) return 0;
    if (x<0||y<0||w<=x||h<=y) return 0x80000000;
    //printf("%d %d %d\n",x,y,map[x][y]);
    if (map[x][y]&0b0001) r=move(x-1,y)+1;
    if (r>0) return r;
    if (map[x][y]&0b0010) r=move(x,y-1)+1;
    if (r>0) return r;
    if (map[x][y]&0b0100) r=move(x+1,y)+1;
    if (r>0) return r;
    if (map[x][y]&0b1000) r=move(x,y+1)+1;
    if (r>0) return r;
    return 0x80000000;
}

main(){
    int i,j,k,m,x,y,f,t,vx,vy,v;
    int ada[1000];
    
    scanf("%d%d%d",&w,&h,&n);
    
    for (x=0;x<w;x++)
        for (y=0;y<h;y++)
            map[x][y]=0;
            
    for (i=0;i<n;i++){
        scanf("%d",&m);
        m++;
        for (j=0;j<m;j++){
            scanf("%d",&k);
            ada[j]=k;
        }
        for (j=1;j<m;j++){
            f=ada[j-1];
            t=ada[j];
            if (t-f>0){
                if (t-f>=w){
                    vx=0;vy=1;v=8;
                }else{
                    vx=1;vy=0;v=4;
                }
            }else{
                if (t-f<=-w){
                    vx=0;vy=-1;v=2;
                }else{
                    vx=-1;vy=0;v=1;
                }
            }
            //printf("%d\n",-1);
            while (1){
                map[f%w][f/w]|=v;
                //printf("%d %d *%d\n",f,t,map[f%w][f/w]);
                f+=vx+vy*w;
                if (f!=t) break;
            }
        }
    }
    j=move(0,0);
    if (j<0) printf("Odekakedekinai..\n");
    else printf("%d\n",j);
    
    return 0;
}
0