#include "stations.h"
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define INF 10000000
#define MOD 1000000007
#define MID ((l+r)/2)
#define HASHMOD 2305843009213693951
#define ll long long
#define ull unsigned long long
#define F first
#define S second
typedef pair<ll, ll> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef map<int, int> mii;
#define EPS 1e-6
#define FOR(i,n) for(int i=0;i<((int)(n));i++)
#define FORi(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define FOA(v, a) for(auto v : a)
vi label(int n, int k, std::vector<int> u, std::vector<int> v) {
vi labels(n);
vector<vi> adj(n, vi());
for (int i = 0; i < n-1; i++) {
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
int f=0;
FOR(i,n){
if(adj[i].size()==1) f = i;
}
vector<bool> vis(n, false);
FOR(i,n){
vis[f] = true;
labels[f] = i;
FOA(v, adj[f]) if(!vis[v]) f = v;
}
//FOA(v, labels) cout<<v<<" ";
//cout<<endl;
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
if(c.size()==1) return c[0];
else{
if(s<t && c[0]<c[1]) return c[1];
else return c[0];
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
640 ms |
492 KB |
Output is correct |
2 |
Correct |
504 ms |
528 KB |
Output is correct |
3 |
Correct |
915 ms |
404 KB |
Output is correct |
4 |
Correct |
733 ms |
536 KB |
Output is correct |
5 |
Correct |
587 ms |
620 KB |
Output is correct |
6 |
Correct |
535 ms |
528 KB |
Output is correct |
7 |
Correct |
623 ms |
492 KB |
Output is correct |
8 |
Correct |
2 ms |
472 KB |
Output is correct |
9 |
Correct |
6 ms |
480 KB |
Output is correct |
10 |
Correct |
2 ms |
472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
276 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
690 ms |
480 KB |
Output is correct |
2 |
Correct |
484 ms |
528 KB |
Output is correct |
3 |
Correct |
879 ms |
472 KB |
Output is correct |
4 |
Correct |
850 ms |
492 KB |
Output is correct |
5 |
Correct |
682 ms |
488 KB |
Output is correct |
6 |
Correct |
458 ms |
520 KB |
Output is correct |
7 |
Correct |
558 ms |
584 KB |
Output is correct |
8 |
Correct |
3 ms |
476 KB |
Output is correct |
9 |
Correct |
6 ms |
472 KB |
Output is correct |
10 |
Correct |
2 ms |
472 KB |
Output is correct |
11 |
Incorrect |
1 ms |
292 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1103 ms |
400 KB |
Output is correct |
2 |
Correct |
813 ms |
488 KB |
Output is correct |
3 |
Correct |
867 ms |
492 KB |
Output is correct |
4 |
Correct |
3 ms |
488 KB |
Output is correct |
5 |
Correct |
5 ms |
472 KB |
Output is correct |
6 |
Correct |
2 ms |
468 KB |
Output is correct |
7 |
Incorrect |
1 ms |
200 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
571 ms |
584 KB |
Output is correct |
2 |
Correct |
453 ms |
520 KB |
Output is correct |
3 |
Correct |
985 ms |
524 KB |
Output is correct |
4 |
Correct |
664 ms |
492 KB |
Output is correct |
5 |
Correct |
583 ms |
400 KB |
Output is correct |
6 |
Correct |
493 ms |
492 KB |
Output is correct |
7 |
Correct |
497 ms |
620 KB |
Output is correct |
8 |
Correct |
4 ms |
472 KB |
Output is correct |
9 |
Correct |
6 ms |
476 KB |
Output is correct |
10 |
Correct |
2 ms |
472 KB |
Output is correct |
11 |
Incorrect |
5 ms |
268 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
12 |
Halted |
0 ms |
0 KB |
- |