#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> adj[1001], col(1001, -1);
int lab = 0;
void dfs(int s, int p)
{
if(col[s]==-1) col[s]=lab, lab++;
for(auto u : adj[s])
if(u!=p) dfs(u, s);
}
vector<int> label(int n, int k, vector<int> a, vector<int> b)
{
col.resize(n); lab=0;
for(int i = 0; i < n; i++) adj[i].clear();
for (int i = 0; i < n-1; i++) {
adj[a[i]].pb(b[i]);
adj[b[i]].pb(a[i]);
}
for(int i = 0; i < n; i++){
if(adj[i].size()==1){
dfs(i, -1); break;
}
}
return col;
}
int find_next_station(int s, int t, vector<int> c)
{
if(c.size()==1)return c[0];
for(int i = 0; i < (int)c.size(); i++)
if(c[i]==t)return c[i];
if(t<s)return c[0];
return c[1];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
292 KB |
Invalid labels (duplicates values). scenario=2, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
312 KB |
Invalid labels (duplicates values). scenario=3, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
320 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
964 ms |
512 KB |
Output is correct |
2 |
Correct |
848 ms |
400 KB |
Output is correct |
3 |
Incorrect |
654 ms |
636 KB |
Wrong query response. |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
308 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |