#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 7;
void dfs( vector<vector<int>> adj, int v, int p, vector<int> &lb, int &cnt ) {
lb[v] = cnt++;
if ( cnt == 1000 ) {
cnt--;
}
for ( auto u: adj[v] ) {
if ( u != p ) {
dfs( adj, u, v, lb, cnt );
}
}
lb[v] *= 1000;
lb[v] += cnt;
}
vector<int> label(int n, int k, vector<int> U, vector<int> V) {
vector < vector < int > > adj(n + 1);
for ( int i = 0; i < n - 1; i++ ) {
int u = U[i], v = V[i];
adj[u].push_back(v);
adj[v].push_back(u);
}
vector < int > lb(n);
int cnt = 0;
dfs( adj, 0, -1, lb, cnt );
return lb;
}
int find_next_station(int s, int t, vector<int> c) {
int tins = s / 1000, touts = s % 1000;
int tint = t / 1000, toutt = t % 1000;
int pr = -1;
for ( auto u: c ) {
int tinu = u / 1000, toutu = u % 1000;
if ( tinu <= tins && toutu >= touts ) {
pr = u;
continue;
}
if ( tinu <= tint && toutu >= toutt ) {
return u;
}
}
assert( pr != -1 );
return pr;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
299 ms |
55252 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6010 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
569 ms |
884 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1512 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
901 ms |
55436 KB |
Output is correct |
2 |
Correct |
1063 ms |
53084 KB |
Output is correct |
3 |
Correct |
811 ms |
400 KB |
Output is correct |
4 |
Correct |
642 ms |
528 KB |
Output is correct |
5 |
Correct |
588 ms |
648 KB |
Output is correct |
6 |
Correct |
1044 ms |
53380 KB |
Output is correct |
7 |
Correct |
502 ms |
42632 KB |
Output is correct |
8 |
Correct |
2 ms |
468 KB |
Output is correct |
9 |
Correct |
4 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
480 KB |
Output is correct |
11 |
Correct |
549 ms |
484 KB |
Output is correct |
12 |
Correct |
1028 ms |
54536 KB |
Output is correct |
13 |
Correct |
1084 ms |
50124 KB |
Output is correct |
14 |
Correct |
494 ms |
3040 KB |
Output is correct |
15 |
Correct |
57 ms |
444 KB |
Output is correct |
16 |
Correct |
223 ms |
528 KB |
Output is correct |
17 |
Incorrect |
597 ms |
740 KB |
Wrong query response. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
838 ms |
476 KB |
Output is correct |
2 |
Correct |
644 ms |
400 KB |
Output is correct |
3 |
Correct |
588 ms |
400 KB |
Output is correct |
4 |
Correct |
3 ms |
476 KB |
Output is correct |
5 |
Correct |
5 ms |
476 KB |
Output is correct |
6 |
Correct |
1 ms |
476 KB |
Output is correct |
7 |
Correct |
591 ms |
488 KB |
Output is correct |
8 |
Correct |
809 ms |
528 KB |
Output is correct |
9 |
Correct |
624 ms |
400 KB |
Output is correct |
10 |
Correct |
538 ms |
400 KB |
Output is correct |
11 |
Correct |
6 ms |
468 KB |
Output is correct |
12 |
Correct |
7 ms |
476 KB |
Output is correct |
13 |
Correct |
5 ms |
476 KB |
Output is correct |
14 |
Correct |
4 ms |
476 KB |
Output is correct |
15 |
Correct |
2 ms |
468 KB |
Output is correct |
16 |
Correct |
499 ms |
528 KB |
Output is correct |
17 |
Correct |
490 ms |
400 KB |
Output is correct |
18 |
Correct |
484 ms |
400 KB |
Output is correct |
19 |
Correct |
503 ms |
528 KB |
Output is correct |
20 |
Correct |
483 ms |
400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
792 ms |
55524 KB |
Partially correct |
2 |
Partially correct |
1004 ms |
48828 KB |
Partially correct |
3 |
Partially correct |
829 ms |
400 KB |
Partially correct |
4 |
Partially correct |
614 ms |
400 KB |
Partially correct |
5 |
Partially correct |
546 ms |
400 KB |
Partially correct |
6 |
Partially correct |
1053 ms |
55404 KB |
Partially correct |
7 |
Partially correct |
545 ms |
31200 KB |
Partially correct |
8 |
Partially correct |
2 ms |
468 KB |
Partially correct |
9 |
Partially correct |
4 ms |
468 KB |
Partially correct |
10 |
Partially correct |
2 ms |
468 KB |
Partially correct |
11 |
Partially correct |
963 ms |
1056 KB |
Partially correct |
12 |
Partially correct |
615 ms |
984 KB |
Partially correct |
13 |
Partially correct |
902 ms |
400 KB |
Partially correct |
14 |
Partially correct |
624 ms |
400 KB |
Partially correct |
15 |
Partially correct |
599 ms |
528 KB |
Partially correct |
16 |
Partially correct |
508 ms |
1104 KB |
Partially correct |
17 |
Partially correct |
522 ms |
404 KB |
Partially correct |
18 |
Partially correct |
988 ms |
37304 KB |
Partially correct |
19 |
Incorrect |
1067 ms |
51628 KB |
Wrong query response. |
20 |
Halted |
0 ms |
0 KB |
- |