#ifndef ARTHUR_LOCAL
#include "stations.h"
#endif
#ifdef ARTHUR_LOCAL
#include <bits/stdc++.h>
#endif
using namespace std;
using ll = long long;
vector<int> adj[1001];
bool vis[1001];
int curv;
int labellist[1001];
void dfs(int v)
{
vis[v]=1;
labellist[v]=curv++;
for(auto u:adj[v])
{
if(!vis[u]) dfs(u);
}
}
vector<int> label(int n, int k, vector<int> U, vector<int> V)
{
for(int i=0; i<n; i++)
{
adj[i].clear();
vis[i]=0;
}
for(int i=0; i<n-1; i++)
{
adj[U[i]].push_back(V[i]);
adj[V[i]].push_back(U[i]);
}
for(int i=0; i<n-1; i++)
{
if(adj[i].size() == 1)
{
curv=0;
dfs(i);
break;
}
}
vector<int> ans;
for(int i=0; i<n; i++)
{
ans.push_back(labellist[i]);
}
return ans;
}
int find_next_station(int s, int t, vector<int> C)
{
if(C.size() == 1) return C[0];
if(s < t)
{
return C[1];
}
else
{
return C[0];
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
519 ms |
800 KB |
Output is correct |
2 |
Correct |
472 ms |
804 KB |
Output is correct |
3 |
Correct |
867 ms |
884 KB |
Output is correct |
4 |
Correct |
697 ms |
888 KB |
Output is correct |
5 |
Correct |
625 ms |
896 KB |
Output is correct |
6 |
Correct |
444 ms |
768 KB |
Output is correct |
7 |
Correct |
432 ms |
936 KB |
Output is correct |
8 |
Correct |
3 ms |
888 KB |
Output is correct |
9 |
Correct |
3 ms |
768 KB |
Output is correct |
10 |
Correct |
1 ms |
768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
508 ms |
780 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
629 ms |
812 KB |
Output is correct |
2 |
Correct |
465 ms |
804 KB |
Output is correct |
3 |
Correct |
910 ms |
888 KB |
Output is correct |
4 |
Correct |
706 ms |
884 KB |
Output is correct |
5 |
Correct |
637 ms |
1152 KB |
Output is correct |
6 |
Correct |
527 ms |
768 KB |
Output is correct |
7 |
Correct |
467 ms |
800 KB |
Output is correct |
8 |
Correct |
2 ms |
892 KB |
Output is correct |
9 |
Correct |
5 ms |
884 KB |
Output is correct |
10 |
Correct |
0 ms |
892 KB |
Output is correct |
11 |
Incorrect |
654 ms |
768 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
985 ms |
888 KB |
Output is correct |
2 |
Correct |
740 ms |
888 KB |
Output is correct |
3 |
Correct |
782 ms |
884 KB |
Output is correct |
4 |
Correct |
2 ms |
892 KB |
Output is correct |
5 |
Correct |
4 ms |
888 KB |
Output is correct |
6 |
Correct |
2 ms |
768 KB |
Output is correct |
7 |
Incorrect |
606 ms |
768 KB |
Wrong query response. |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
605 ms |
800 KB |
Output is correct |
2 |
Correct |
537 ms |
804 KB |
Output is correct |
3 |
Correct |
1101 ms |
768 KB |
Output is correct |
4 |
Correct |
803 ms |
884 KB |
Output is correct |
5 |
Correct |
638 ms |
768 KB |
Output is correct |
6 |
Correct |
467 ms |
804 KB |
Output is correct |
7 |
Correct |
453 ms |
804 KB |
Output is correct |
8 |
Correct |
2 ms |
896 KB |
Output is correct |
9 |
Correct |
3 ms |
768 KB |
Output is correct |
10 |
Correct |
0 ms |
888 KB |
Output is correct |
11 |
Incorrect |
497 ms |
832 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |