#include "stations.h"
//#pragma GCC target("avx2")
//#pragma GCC optimization("O3")
//#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int ti;
vector<vector<int>> g;
void dfs(int v, int p, vector<int>& labels){
for(auto u : g[v]){
if(u == p)
continue;
dfs(u, v, labels);
}
labels[v] = ti++;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v){
g.resize(n);
for(int i = 0; i < n-1; i++){
g[u[i]].pb(v[i]);
g[v[i]].pb(u[i]);
}
vector<int> labels(n);
dfs(0, -1, labels);
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
for(auto v : c){
if(v >= t)
return v;
}
for(auto v : c){
if(v >= s){
return v;
}
}
}
Compilation message
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:50:1: warning: control reaches end of non-void function [-Wreturn-type]
50 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3043 ms |
2496 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1905 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
903 ms |
756 KB |
Output is correct |
2 |
Runtime error |
1213 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2484 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |