Submission #145575

# Submission time Handle Problem Language Result Execution time Memory
145575 2019-08-20T12:18:09 Z surface03 None (KOI18_robot) C++14
100 / 100
97 ms 12664 KB
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>>v[100010];
int n,st,ed,visit[100010];
void f(int now,int tot,int maxi){
    if(now==ed){
        printf("%d",tot-maxi);
        exit(0);
    }
    for(auto&i:v[now]){
        if(visit[i.first])continue;
        visit[i.first]=1;
        f(i.first,tot+i.second,max(maxi,i.second));
        visit[i.first]=0;
    }
}
int main(){
    scanf("%d%d%d",&n,&st,&ed);
    for(int i=0,n1,n2,n3;i<n-1;i++){
        scanf("%d%d%d",&n1,&n2,&n3);
        v[n1].push_back(make_pair(n2,n3));
        v[n2].push_back(make_pair(n1,n3));
    }
    visit[st]=1;
    f(st,0,0);
}

Compilation message

robot.cpp: In function 'int main()':
robot.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d",&n,&st,&ed);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~
robot.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d",&n1,&n2,&n3);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 56 ms 12664 KB Output is correct
2 Correct 50 ms 7312 KB Output is correct
3 Correct 48 ms 7800 KB Output is correct
4 Correct 5 ms 2680 KB Output is correct
5 Correct 10 ms 3704 KB Output is correct
6 Correct 12 ms 3832 KB Output is correct
7 Correct 4 ms 2680 KB Output is correct
8 Correct 14 ms 3704 KB Output is correct
9 Correct 5 ms 2808 KB Output is correct
10 Correct 16 ms 4512 KB Output is correct
11 Correct 4 ms 2680 KB Output is correct
12 Correct 4 ms 2808 KB Output is correct
13 Correct 19 ms 4600 KB Output is correct
14 Correct 22 ms 6008 KB Output is correct
15 Correct 7 ms 2936 KB Output is correct
16 Correct 25 ms 5752 KB Output is correct
17 Correct 28 ms 6776 KB Output is correct
18 Correct 32 ms 6776 KB Output is correct
19 Correct 7 ms 3064 KB Output is correct
20 Correct 35 ms 7544 KB Output is correct
21 Correct 40 ms 8056 KB Output is correct
22 Correct 43 ms 8008 KB Output is correct
23 Correct 8 ms 3192 KB Output is correct
24 Correct 47 ms 7800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 88 ms 8684 KB Output is correct
2 Correct 53 ms 7928 KB Output is correct
3 Correct 5 ms 2680 KB Output is correct
4 Correct 4 ms 2808 KB Output is correct
5 Correct 13 ms 3576 KB Output is correct
6 Correct 12 ms 3832 KB Output is correct
7 Correct 3 ms 2680 KB Output is correct
8 Correct 16 ms 4444 KB Output is correct
9 Correct 15 ms 4084 KB Output is correct
10 Correct 4 ms 2808 KB Output is correct
11 Correct 22 ms 6008 KB Output is correct
12 Correct 25 ms 4728 KB Output is correct
13 Correct 6 ms 2936 KB Output is correct
14 Correct 7 ms 3064 KB Output is correct
15 Correct 37 ms 5624 KB Output is correct
16 Correct 32 ms 6648 KB Output is correct
17 Correct 34 ms 7544 KB Output is correct
18 Correct 36 ms 6384 KB Output is correct
19 Correct 41 ms 7928 KB Output is correct
20 Correct 61 ms 7256 KB Output is correct
21 Correct 8 ms 3064 KB Output is correct
22 Correct 9 ms 3320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2680 KB Output is correct
2 Correct 5 ms 2808 KB Output is correct
3 Correct 5 ms 2780 KB Output is correct
4 Correct 4 ms 2808 KB Output is correct
5 Correct 6 ms 2940 KB Output is correct
6 Correct 7 ms 2936 KB Output is correct
7 Correct 5 ms 2808 KB Output is correct
8 Correct 5 ms 2936 KB Output is correct
9 Correct 4 ms 2680 KB Output is correct
10 Correct 6 ms 2936 KB Output is correct
11 Correct 6 ms 2852 KB Output is correct
12 Correct 6 ms 3064 KB Output is correct
13 Correct 6 ms 2936 KB Output is correct
14 Correct 6 ms 2936 KB Output is correct
15 Correct 7 ms 3064 KB Output is correct
16 Correct 4 ms 2680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 9080 KB Output is correct
2 Correct 75 ms 8696 KB Output is correct
3 Correct 55 ms 12408 KB Output is correct
4 Correct 51 ms 7416 KB Output is correct
5 Correct 48 ms 7880 KB Output is correct
6 Correct 97 ms 12536 KB Output is correct
7 Correct 5 ms 2808 KB Output is correct
8 Correct 5 ms 2680 KB Output is correct
9 Correct 5 ms 2808 KB Output is correct
10 Correct 11 ms 3704 KB Output is correct
11 Correct 5 ms 2808 KB Output is correct
12 Correct 16 ms 3704 KB Output is correct
13 Correct 14 ms 3704 KB Output is correct
14 Correct 12 ms 3960 KB Output is correct
15 Correct 4 ms 2712 KB Output is correct
16 Correct 6 ms 2936 KB Output is correct
17 Correct 14 ms 3704 KB Output is correct
18 Correct 5 ms 2936 KB Output is correct
19 Correct 16 ms 4388 KB Output is correct
20 Correct 16 ms 4216 KB Output is correct
21 Correct 15 ms 4084 KB Output is correct
22 Correct 5 ms 2808 KB Output is correct
23 Correct 4 ms 2680 KB Output is correct
24 Correct 4 ms 2808 KB Output is correct
25 Correct 6 ms 2808 KB Output is correct
26 Correct 19 ms 4732 KB Output is correct
27 Correct 6 ms 2936 KB Output is correct
28 Correct 22 ms 6012 KB Output is correct
29 Correct 27 ms 4732 KB Output is correct
30 Correct 27 ms 4600 KB Output is correct
31 Correct 7 ms 3064 KB Output is correct
32 Correct 6 ms 2936 KB Output is correct
33 Correct 6 ms 2940 KB Output is correct
34 Correct 25 ms 5624 KB Output is correct
35 Correct 7 ms 2808 KB Output is correct
36 Correct 37 ms 5880 KB Output is correct
37 Correct 36 ms 5580 KB Output is correct
38 Correct 28 ms 6776 KB Output is correct
39 Correct 7 ms 2936 KB Output is correct
40 Correct 4 ms 2680 KB Output is correct
41 Correct 32 ms 7032 KB Output is correct
42 Correct 7 ms 2936 KB Output is correct
43 Correct 34 ms 7544 KB Output is correct
44 Correct 38 ms 6384 KB Output is correct
45 Correct 35 ms 6384 KB Output is correct
46 Correct 40 ms 8056 KB Output is correct
47 Correct 42 ms 8056 KB Output is correct
48 Correct 64 ms 7288 KB Output is correct
49 Correct 59 ms 7292 KB Output is correct
50 Correct 8 ms 3064 KB Output is correct
51 Correct 9 ms 3192 KB Output is correct
52 Correct 9 ms 3192 KB Output is correct
53 Correct 46 ms 7544 KB Output is correct