답안 #295950

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
295950 2020-09-10T06:33:05 Z Badrangiikh 경주 (Race) (IOI11_race) C++14
21 / 100
97 ms 4740 KB
#include "race.h"
#include<bits/stdc++.h>
using namespace std;

int n , x , y , z , k , ans = 10000 ;
vector < int > vec [ 1005 ] ;
map < pair < int , int > , int > mp ;

void go ( int chi , int par , int len , int depth ) {
    if ( len == k ) {
        ans = min ( ans , depth ) ;
    }
    for ( int i = 0 ; i < vec [ chi ] . size ( ) ; i ++ ) {
        if ( vec [ chi ] [ i ] == par ) continue ;
        go ( vec [ chi ] [ i ] , chi , len + mp [ { vec [ chi ] [ i ] , chi } ] , depth + 1 ) ;
    }
    return ;
}

int best_path(int N, int K, int H[][2], int L[])
{
	k = K ;
  for ( int i = 0 ; i < N - 1 ; i ++ ) {
        vec [ H [ i ] [ 0 ] ] . push_back ( H [ i ] [ 1 ] ) ;
        vec [ H [ i ] [ 1 ] ] . push_back ( H [ i ] [ 0 ] ) ;
        mp [ { H [ i ] [ 0 ] , H [ i ] [ 1 ] } ] = L [ i ] ;
        mp [ { H [ i ] [ 1 ] , H [ i ] [ 0 ] } ] = L [ i ] ;
    }
    for ( int i = 0 ; i < N ; i ++ ) {
        go ( i , -1 , 0 , 0 ) ;
    }
    if ( ans == 10000 ) return -1 ;
    else return ans ;
}

Compilation message

race.cpp: In function 'void go(int, int, int, int)':
race.cpp:13:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for ( int i = 0 ; i < vec [ chi ] . size ( ) ; i ++ ) {
      |                       ~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 96 ms 512 KB Output is correct
22 Correct 93 ms 512 KB Output is correct
23 Correct 94 ms 512 KB Output is correct
24 Correct 92 ms 580 KB Output is correct
25 Correct 91 ms 512 KB Output is correct
26 Correct 95 ms 512 KB Output is correct
27 Correct 91 ms 512 KB Output is correct
28 Correct 93 ms 640 KB Output is correct
29 Correct 92 ms 512 KB Output is correct
30 Correct 97 ms 580 KB Output is correct
31 Correct 93 ms 512 KB Output is correct
32 Correct 92 ms 588 KB Output is correct
33 Correct 93 ms 632 KB Output is correct
34 Correct 70 ms 512 KB Output is correct
35 Correct 65 ms 512 KB Output is correct
36 Correct 56 ms 512 KB Output is correct
37 Correct 56 ms 632 KB Output is correct
38 Correct 72 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Runtime error 39 ms 4740 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 96 ms 512 KB Output is correct
22 Correct 93 ms 512 KB Output is correct
23 Correct 94 ms 512 KB Output is correct
24 Correct 92 ms 580 KB Output is correct
25 Correct 91 ms 512 KB Output is correct
26 Correct 95 ms 512 KB Output is correct
27 Correct 91 ms 512 KB Output is correct
28 Correct 93 ms 640 KB Output is correct
29 Correct 92 ms 512 KB Output is correct
30 Correct 97 ms 580 KB Output is correct
31 Correct 93 ms 512 KB Output is correct
32 Correct 92 ms 588 KB Output is correct
33 Correct 93 ms 632 KB Output is correct
34 Correct 70 ms 512 KB Output is correct
35 Correct 65 ms 512 KB Output is correct
36 Correct 56 ms 512 KB Output is correct
37 Correct 56 ms 632 KB Output is correct
38 Correct 72 ms 512 KB Output is correct
39 Runtime error 39 ms 4740 KB Execution killed with signal 11
40 Halted 0 ms 0 KB -