#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define X first
#define Y second
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define SZ(a) ((int)a.size())
const int C=1000;
vector<int> G[1005],idx;
int dft;
void dfs(int u,int f)
{
idx[u]=(++dft)*C;
for(int i:G[u])
if(i!=f)
dfs(i,u);
idx[u]+=dft;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v)
{
idx.resize(n),dft=-1;
for(int i=0;i<n;++i)
G[i].clear();
for(int i=0;i+1<n;++i)
G[u[i]].pb(v[i]),G[v[i]].pb(u[i]);
dfs(0,0);
return idx;
}
int find_next_station(int s, int t, vector<int> c)
{
if(s/C<=t/C&&s%C>=t%C)
for(int i:c)
{
if(i>s&&i/C<=t/C&&i%C>=t%C)
return i;
}
return *min_element(ALL(c));
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6009 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1511 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
556 ms |
1024 KB |
Output is correct |
2 |
Correct |
462 ms |
772 KB |
Output is correct |
3 |
Correct |
874 ms |
880 KB |
Output is correct |
4 |
Correct |
673 ms |
768 KB |
Output is correct |
5 |
Correct |
616 ms |
768 KB |
Output is correct |
6 |
Correct |
471 ms |
772 KB |
Output is correct |
7 |
Correct |
470 ms |
796 KB |
Output is correct |
8 |
Correct |
3 ms |
768 KB |
Output is correct |
9 |
Correct |
5 ms |
884 KB |
Output is correct |
10 |
Correct |
1 ms |
768 KB |
Output is correct |
11 |
Correct |
606 ms |
888 KB |
Output is correct |
12 |
Correct |
480 ms |
772 KB |
Output is correct |
13 |
Correct |
479 ms |
816 KB |
Output is correct |
14 |
Correct |
446 ms |
824 KB |
Output is correct |
15 |
Correct |
60 ms |
864 KB |
Output is correct |
16 |
Correct |
72 ms |
1024 KB |
Output is correct |
17 |
Correct |
124 ms |
820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
900 ms |
768 KB |
Output is correct |
2 |
Correct |
659 ms |
876 KB |
Output is correct |
3 |
Correct |
623 ms |
880 KB |
Output is correct |
4 |
Correct |
3 ms |
884 KB |
Output is correct |
5 |
Correct |
5 ms |
884 KB |
Output is correct |
6 |
Correct |
1 ms |
768 KB |
Output is correct |
7 |
Correct |
631 ms |
768 KB |
Output is correct |
8 |
Correct |
874 ms |
1040 KB |
Output is correct |
9 |
Correct |
662 ms |
876 KB |
Output is correct |
10 |
Correct |
591 ms |
876 KB |
Output is correct |
11 |
Correct |
4 ms |
768 KB |
Output is correct |
12 |
Correct |
5 ms |
768 KB |
Output is correct |
13 |
Correct |
5 ms |
1132 KB |
Output is correct |
14 |
Correct |
3 ms |
768 KB |
Output is correct |
15 |
Correct |
2 ms |
876 KB |
Output is correct |
16 |
Correct |
525 ms |
880 KB |
Output is correct |
17 |
Correct |
507 ms |
768 KB |
Output is correct |
18 |
Correct |
514 ms |
768 KB |
Output is correct |
19 |
Correct |
511 ms |
880 KB |
Output is correct |
20 |
Correct |
501 ms |
1024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
556 ms |
1024 KB |
Partially correct |
2 |
Partially correct |
465 ms |
896 KB |
Partially correct |
3 |
Partially correct |
894 ms |
768 KB |
Partially correct |
4 |
Partially correct |
661 ms |
768 KB |
Partially correct |
5 |
Partially correct |
584 ms |
1024 KB |
Partially correct |
6 |
Partially correct |
458 ms |
772 KB |
Partially correct |
7 |
Partially correct |
468 ms |
812 KB |
Partially correct |
8 |
Partially correct |
3 ms |
888 KB |
Partially correct |
9 |
Partially correct |
4 ms |
768 KB |
Partially correct |
10 |
Partially correct |
1 ms |
768 KB |
Partially correct |
11 |
Partially correct |
459 ms |
808 KB |
Partially correct |
12 |
Partially correct |
565 ms |
768 KB |
Partially correct |
13 |
Partially correct |
979 ms |
768 KB |
Partially correct |
14 |
Partially correct |
749 ms |
872 KB |
Partially correct |
15 |
Partially correct |
597 ms |
876 KB |
Partially correct |
16 |
Partially correct |
484 ms |
824 KB |
Partially correct |
17 |
Partially correct |
617 ms |
768 KB |
Partially correct |
18 |
Partially correct |
465 ms |
1232 KB |
Partially correct |
19 |
Partially correct |
491 ms |
1008 KB |
Partially correct |
20 |
Partially correct |
644 ms |
768 KB |
Partially correct |
21 |
Partially correct |
73 ms |
864 KB |
Partially correct |
22 |
Partially correct |
101 ms |
848 KB |
Partially correct |
23 |
Partially correct |
124 ms |
808 KB |
Partially correct |
24 |
Partially correct |
7 ms |
876 KB |
Partially correct |
25 |
Partially correct |
6 ms |
768 KB |
Partially correct |
26 |
Partially correct |
4 ms |
768 KB |
Partially correct |
27 |
Partially correct |
4 ms |
768 KB |
Partially correct |
28 |
Partially correct |
2 ms |
884 KB |
Partially correct |
29 |
Partially correct |
566 ms |
768 KB |
Partially correct |
30 |
Partially correct |
587 ms |
1048 KB |
Partially correct |
31 |
Partially correct |
696 ms |
1028 KB |
Partially correct |
32 |
Partially correct |
632 ms |
768 KB |
Partially correct |
33 |
Partially correct |
640 ms |
1024 KB |
Partially correct |
34 |
Partially correct |
440 ms |
768 KB |
Partially correct |
35 |
Partially correct |
544 ms |
768 KB |
Partially correct |
36 |
Partially correct |
657 ms |
768 KB |
Partially correct |
37 |
Partially correct |
469 ms |
896 KB |
Partially correct |
38 |
Partially correct |
465 ms |
776 KB |
Partially correct |
39 |
Partially correct |
554 ms |
780 KB |
Partially correct |
40 |
Partially correct |
612 ms |
768 KB |
Partially correct |
41 |
Partially correct |
475 ms |
896 KB |
Partially correct |
42 |
Partially correct |
66 ms |
768 KB |
Partially correct |
43 |
Partially correct |
118 ms |
768 KB |
Partially correct |
44 |
Partially correct |
183 ms |
768 KB |
Partially correct |
45 |
Partially correct |
193 ms |
788 KB |
Partially correct |
46 |
Partially correct |
381 ms |
828 KB |
Partially correct |
47 |
Partially correct |
364 ms |
804 KB |
Partially correct |
48 |
Partially correct |
69 ms |
784 KB |
Partially correct |
49 |
Partially correct |
79 ms |
1028 KB |
Partially correct |