#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++;
for ( auto u: adj[v] ) {
if ( u != p ) {
dfs( adj, u, v, lb, cnt );
}
}
lb[v] *= 1000;
if ( cnt == 1000 ) {
cnt--;
}
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 |
290 ms |
55232 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 |
540 ms |
904 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 |
817 ms |
55388 KB |
Output is correct |
2 |
Correct |
1016 ms |
53272 KB |
Output is correct |
3 |
Correct |
800 ms |
484 KB |
Output is correct |
4 |
Correct |
680 ms |
488 KB |
Output is correct |
5 |
Correct |
540 ms |
400 KB |
Output is correct |
6 |
Correct |
1028 ms |
53420 KB |
Output is correct |
7 |
Correct |
486 ms |
42504 KB |
Output is correct |
8 |
Correct |
3 ms |
480 KB |
Output is correct |
9 |
Correct |
4 ms |
552 KB |
Output is correct |
10 |
Correct |
0 ms |
468 KB |
Output is correct |
11 |
Correct |
555 ms |
488 KB |
Output is correct |
12 |
Correct |
1020 ms |
54388 KB |
Output is correct |
13 |
Correct |
1068 ms |
50260 KB |
Output is correct |
14 |
Correct |
490 ms |
3044 KB |
Output is correct |
15 |
Correct |
64 ms |
412 KB |
Output is correct |
16 |
Correct |
215 ms |
632 KB |
Output is correct |
17 |
Incorrect |
580 ms |
712 KB |
Wrong query response. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
825 ms |
400 KB |
Output is correct |
2 |
Correct |
649 ms |
400 KB |
Output is correct |
3 |
Correct |
566 ms |
400 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
5 |
Correct |
5 ms |
468 KB |
Output is correct |
6 |
Correct |
2 ms |
468 KB |
Output is correct |
7 |
Correct |
567 ms |
520 KB |
Output is correct |
8 |
Correct |
842 ms |
488 KB |
Output is correct |
9 |
Correct |
623 ms |
400 KB |
Output is correct |
10 |
Correct |
547 ms |
528 KB |
Output is correct |
11 |
Correct |
6 ms |
468 KB |
Output is correct |
12 |
Correct |
5 ms |
476 KB |
Output is correct |
13 |
Correct |
5 ms |
468 KB |
Output is correct |
14 |
Correct |
4 ms |
472 KB |
Output is correct |
15 |
Correct |
2 ms |
568 KB |
Output is correct |
16 |
Correct |
511 ms |
588 KB |
Output is correct |
17 |
Correct |
499 ms |
400 KB |
Output is correct |
18 |
Correct |
483 ms |
400 KB |
Output is correct |
19 |
Correct |
465 ms |
400 KB |
Output is correct |
20 |
Correct |
485 ms |
508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
832 ms |
55552 KB |
Partially correct |
2 |
Partially correct |
992 ms |
48748 KB |
Partially correct |
3 |
Partially correct |
843 ms |
464 KB |
Partially correct |
4 |
Partially correct |
656 ms |
484 KB |
Partially correct |
5 |
Partially correct |
559 ms |
492 KB |
Partially correct |
6 |
Partially correct |
993 ms |
55492 KB |
Partially correct |
7 |
Partially correct |
510 ms |
31196 KB |
Partially correct |
8 |
Partially correct |
3 ms |
496 KB |
Partially correct |
9 |
Partially correct |
5 ms |
468 KB |
Partially correct |
10 |
Partially correct |
2 ms |
472 KB |
Partially correct |
11 |
Partially correct |
955 ms |
1056 KB |
Partially correct |
12 |
Partially correct |
604 ms |
1168 KB |
Partially correct |
13 |
Partially correct |
811 ms |
528 KB |
Partially correct |
14 |
Partially correct |
616 ms |
520 KB |
Partially correct |
15 |
Partially correct |
558 ms |
400 KB |
Partially correct |
16 |
Partially correct |
494 ms |
1088 KB |
Partially correct |
17 |
Partially correct |
551 ms |
428 KB |
Partially correct |
18 |
Partially correct |
981 ms |
37384 KB |
Partially correct |
19 |
Incorrect |
1016 ms |
51628 KB |
Wrong query response. |
20 |
Halted |
0 ms |
0 KB |
- |