#include <bits/stdc++.h>
using namespace std;
vector <int> path[1111];
stack <int> walk;
int pass[1111];
vector <int> la;
vector <int> label(int n, int k, vector<int> u, vector<int> v)
{
la.clear();
int i,x;
for(i=0;i<n;i++)
{
pass[i]=0;
la.push_back(0);
path[i].clear();
}
x=u.size();
for(i=0;i<x;i++)
{
path[u[i]].push_back(v[i]);
path[v[i]].push_back(u[i]);
}
for(i=0;i<n;i++)
{
if(path[i].size()==1)
{
walk.push(i);
break;
}
}
x=0;
while(!walk.empty())
{
i=walk.top();
walk.pop();
if(pass[i]==1) continue;
pass[i]=1;
la[i]=x;
x++;
for(auto a:path[i])
{
if(pass[a]==1) continue;
walk.push(a);
}
}
return la;
}
int find_next_station(int s, int t, vector<int> c)
{
if(s<t) return s+1;
else return s-1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
523 ms |
516 KB |
Output is correct |
2 |
Correct |
396 ms |
732 KB |
Output is correct |
3 |
Correct |
812 ms |
516 KB |
Output is correct |
4 |
Correct |
598 ms |
516 KB |
Output is correct |
5 |
Correct |
543 ms |
516 KB |
Output is correct |
6 |
Correct |
420 ms |
528 KB |
Output is correct |
7 |
Correct |
402 ms |
528 KB |
Output is correct |
8 |
Correct |
2 ms |
596 KB |
Output is correct |
9 |
Correct |
4 ms |
468 KB |
Output is correct |
10 |
Correct |
0 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
438 ms |
520 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
475 ms |
508 KB |
Output is correct |
2 |
Correct |
419 ms |
520 KB |
Output is correct |
3 |
Correct |
792 ms |
520 KB |
Output is correct |
4 |
Correct |
640 ms |
400 KB |
Output is correct |
5 |
Correct |
546 ms |
400 KB |
Output is correct |
6 |
Correct |
489 ms |
524 KB |
Output is correct |
7 |
Correct |
406 ms |
528 KB |
Output is correct |
8 |
Correct |
2 ms |
476 KB |
Output is correct |
9 |
Correct |
4 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Incorrect |
513 ms |
400 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
863 ms |
404 KB |
Output is correct |
2 |
Correct |
649 ms |
404 KB |
Output is correct |
3 |
Correct |
564 ms |
648 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
5 ms |
464 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Incorrect |
572 ms |
600 KB |
Wrong query response. |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
525 ms |
532 KB |
Output is correct |
2 |
Correct |
410 ms |
520 KB |
Output is correct |
3 |
Correct |
953 ms |
400 KB |
Output is correct |
4 |
Correct |
598 ms |
512 KB |
Output is correct |
5 |
Correct |
579 ms |
552 KB |
Output is correct |
6 |
Correct |
415 ms |
516 KB |
Output is correct |
7 |
Correct |
440 ms |
528 KB |
Output is correct |
8 |
Correct |
3 ms |
596 KB |
Output is correct |
9 |
Correct |
4 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Incorrect |
426 ms |
532 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |