結果

問題 No.1 道のショートカット
ユーザー roaiziroroaiziro
提出日時 2015-09-20 07:29:30
言語 C90
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,583 bytes
コンパイル時間 907 ms
コンパイル使用メモリ 24,552 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-09-22 12:29:12
合計ジャッジ時間 10,022 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,260 KB
testcase_01 AC 0 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 0 ms
4,380 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2,820 ms
4,376 KB
testcase_12 AC 15 ms
4,380 KB
testcase_13 AC 8 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 0 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 TLE -
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 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>

#define N 50
#define V 1500

struct DATE{
    int s, t, y, m;
}date[V];

struct NODE{
    struct DATE *dv[V];
    int vn;
}node[N];

int gcost, gsizen, gsizev, gmin = -1;



void createtree(void)
{
    int i, j;
    for(i = 0; i < gsizev; i++){
        j = date[i].s;
        node[j].dv[node[j].vn] = &date[i];
        node[j].vn++;
    }
    return;
}


int trece1(int i, int cost, int time)
{
    int j, ans;
    if(gsizen == i){
      //  printf("trece1 %d\n", time);
        if(gmin == -1 || time < gmin){
            gmin = time;
        }
        return(gmin);
    }
    
    for(j = 0; j < node[i].vn; j++){
        if(cost+node[i].dv[j]->y <= gcost){
            ans = trece1(node[i].dv[j]->t, cost+node[i].dv[j]->y, time+node[i].dv[j]->m);
        }
    }
    return(gmin);
}

int trece(void)
{
    trece1(1, 0, 0);
    return(gmin);
}


int main(int argc, const char * argv[])
{
        int i;
        // insert code here...
        scanf("%d", &gsizen);
        scanf("%d", &gcost);
        scanf("%d", &gsizev);
        for(i = 0; i < gsizev; i++){
            scanf("%d", &date[i].s);
        }
        for(i = 0; i < gsizev; i++){
            scanf("%d", &date[i].t);
        }
        for(i = 0; i < gsizev; i++){
            scanf("%d", &date[i].y);
        }
        for(i = 0; i < gsizev; i++){
            scanf("%d", &date[i].m);
        }
//        for(i = 0; i < gsizev; i++){
//           printf("%d %d %d %d\n", date[i].s, date[i].t, date[i].y, date[i].m);
//        }
        createtree();
        printf("%d\n", trece());
    return 0;
}
0