#include <bits/stdc++.h>
#include "stations.h"
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define N 200005
#define PB push_back
#define sz(x) int(x.size())
#define F first
#define M ll(1e9 + 7)
#define S second
#define all(x) x.begin(), x.end()
#define endl '\n'
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
//typedef tree <int, null_type, less_equal <int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll mlt(ll x, ll y) {return (x * y) % M;}
ll sm(ll x, ll y) {return (x + y) % M;}
vector <int> g[N], a;
int id = 0;
void dfs(int v, int p, int hr)
{
id++;
if (hr % 2 == 0) a[v] = id;
for (auto it : g[v])
{
if (it == p) continue;
dfs(it, v, hr + 1);
}
id++;
if (hr % 2) a[v] = id;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v)
{
for (int i = 0; i < n; i++) g[i].clear();
a.resize(n);
id = 0;
for (int i = 0; i < n - 1; i++)
{
g[u[i]].PB(v[i]);
g[v[i]].PB(u[i]);
}
dfs(0, -1, 0);
return a;
}
int find_next_station(int s, int t, vector<int> c)
{
// sort(all(c));
//
// if (c.back() < s)
// {
// if (t > s) return c[0];
//
// int i = 1;
//
// while (i < sz(c) && t <= c[i]) i++;
//
// if (i == 0) return c[0];
//
// return c[i - 1];
// }
// else
// {
// if (t < s) return c.back();
//
// int i = 0;
//
// while (i < sz(c) && t > c[i]) i++;
//
// return c[i];
// }
}
//int main()
//{
// iostream::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//
// //freopen("fcolor.in", "r", stdin); freopen("fcolor.out", "w", stdout);
//
//
//}
Compilation message
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:99:1: warning: no return statement in function returning non-void [-Wreturn-type]
99 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
5120 KB |
Invalid labels (values out of range). scenario=2, k=1000, vertex=1, label=1991 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
5112 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1023 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
19 ms |
15384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
17 ms |
15276 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
19 ms |
15392 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |