#include "stations.h"
#include <bits/stdc++.h>
#define maxn 1001
using namespace std;
typedef vector <int> vi;
typedef vector <vi> vvi;
int cont;
vi dfs(int n, int x, vvi g, int pai, vi resp){
int i;
for(i=0;i<g[x].size();i++){
if(g[x][i]!=pai){
resp = dfs(n, g[x][i], g, x, resp);
}
}
resp[x] = cont++;
return resp;
}
vi label(int n, int k, vi u, vi v){
vvi g = vvi(n);
vi resp = vi(n, 0);
for(int i=0;i<n-1;i++){
g[u[i]].push_back(v[i]);
}
cont = 0;
return dfs(n, 0, g, 0, resp);
}
int find_next_station(int s, int t, vi c){
int l=0, r=c.size()-1, mid;
while(r>l){
mid = (l+r)/2;
if(t<=c[mid]){
r = mid;
}
else l = mid+1;
}
return c[l];
}
Compilation message
stations.cpp: In function 'vi dfs(int, int, vvi, int, vi)':
stations.cpp:13:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
13 | for(i=0;i<g[x].size();i++){
| ~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
464 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
768 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
424 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Invalid labels (duplicates values). scenario=2, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
672 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |