QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#140441#1139. StationsQwerty1232#0 46ms3888kbC++201.2kb2023-08-15 22:23:172024-07-04 01:44:55

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 01:44:55]
  • 评测
  • 测评结果:0
  • 用时:46ms
  • 内存:3888kb
  • [2023-08-15 22:23:17]
  • 提交

stations

#include "stations.h"

#include <bits/stdc++.h>

#include <cassert>
#include <vector>

constexpr int N = 1e3;

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
    std::vector<std::vector<int>> gr(n);
    for (int i = 0; i < n - 1; i++) {
        gr[u[i]].push_back(v[i]);
        gr[v[i]].push_back(u[i]);
    }
    std::vector<int> res(n);
    auto dfs = [&](auto dfs, int v, int f, int d, int& e) -> void {
        for (int t : gr[v]) {
            if (t != f) {
                dfs(dfs, t, v, d + 1, e);
            }
        }
        res[v] = e++;
    };
    int e = 0;
    dfs(dfs, 0, -1, 0, e);

    return res;
}

int find_next_station(int s, int dest, std::vector<int> c) {
    assert(s != dest);
    for (int to : c) {
        if (to == dest) {
            return to;
        }
    }
    if (std::all_of(c.begin(), c.end(), std::bind(std::greater<int>(), s, std::placeholders::_1))) {
        int it = std::lower_bound(c.begin(), c.end(), dest) - c.begin();
        return c[it];
    }
    if (dest > s) {
        return c.back();
    }

    int it = std::lower_bound(c.begin(), c.end(), dest) - c.begin();
    return c[it];

    assert(false);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3752kb

input:

0
10
7 1000000000
5 3
6 3
0 3
4 3
1 3
2 3
7 1000000000
3 0
4 0
5 0
1 0
2 0
6 0
7 1000000000
4 0
2 0
3 0
6 0
1 0
5 4
7 1000000000
4 1
0 1
5 1
3 1
2 1
6 4
7 1000000000
3 1
2 1
5 1
4 1
6 1
0 3
7 1000000000
6 3
1 3
0 3
2 3
4 6
5 6
7 1000000000
5 0
4 0
3 0
2 0
6 5
1 5
7 1000000000
0 1
6 1
5 1
3 1
4 0
2 0...

output:

7
6
3
4
5
2
0
1
7
6
3
4
0
1
2
5
7
6
5
2
3
1
0
4
7
6
5
4
3
1
2
0
7
6
4
0
5
2
1
3
7
6
3
4
5
0
1
2
7
6
1
5
4
3
2
0
7
6
3
5
2
4
1
0
7
6
1
2
5
0
3
4
7
6
5
1
2
3
4
0

input:

1
420
2 4 3
0
1
5
4 1 1
5
1 3 2
0
6
3 6 1
5
3 5 1
6
0 5 1
2
1 2 1
3
1 5 1
2
2 3 1
5
4 3 5
0
1
2
3
5
2 6 1
5
6 5 1
5
5 6 5
1
2
3
4
6
0 4 1
1
0 1 1
3
0 4 1
5
3 1 1
5
2 5 1
4
1 6 1
6
2 4 1
3
4 3 1
6
5 2 2
4
6
5 0 1
6
6 0 5
1
2
3
4
5
0 3 1
6
1 4 1
4
2 1 1
5
6 0 1
5
1 2 2
0
6
4 6 5
0
1
2
3
5
5 4 1
6
6 3 ...

output:

5
5
6
5
6
2
3
2
5
3
5
5
6
1
3
5
5
4
6
3
6
4
6
1
6
4
5
5
6
5
6
3
5
6
4
6
1
6
1
1
5
2
4
1
3
6
2
6
3
6
4
4
3
6
6
6
0
6
6
4
5
4
6
5
6
6
6
5
1
5
4
6
0
5
2
3
6
5
6
5
2
4
4
3
3
6
6
5
1
5
4
4
5
6
3
2
6
6
3
6
5
5
6
5
6
5
4
6
3
6
6
5
0
4
6
1
2
6
6
6
5
2
2
6
4
1
4
4
6
1
4
4
3
2
2
5
5
6
1
2
6
6
6
5
6
5
1
2
5
6
...

result:

wrong answer Diff at 210-th number: read 2 but expected 6

Subtask #2:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 32ms
memory: 3888kb

input:

0
10
996 1000
0 1
2 0
1 3
4 1
5 2
6 2
7 3
3 8
4 9
10 4
11 5
12 5
6 13
14 6
7 15
7 16
17 8
18 8
19 9
9 20
21 10
10 22
23 11
24 11
12 25
26 12
27 13
13 28
14 29
30 14
15 31
15 32
16 33
34 16
35 17
17 36
18 37
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
23 47
48 23
49 24
24 50
25 51
52 25
26 ...

output:

996
995
510
994
254
509
765
993
126
253
381
508
637
764
892
992
62
125
189
252
317
380
444
507
573
636
700
763
828
891
955
991
30
61
93
124
157
188
220
251
285
316
348
379
412
443
475
506
541
572
604
635
668
699
731
762
796
827
859
890
923
954
975
990
14
29
45
60
77
92
108
123
141
156
172
187
204
21...

input:

1
50252
724 377 1
725
847 141 1
849
982 518 1
983
404 396 1
406
852 218 1
853
416 919 1
418
702 708 1
703
429 773 1
430
710 748 3
708
709
714
866 474 3
862
865
874
988 10 1
989
594 138 3
592
593
595
777 511 1
778
398 920 1
399
286 995 1
288
66 142 1
68
862 929 3
860
861
866
316 305 3
300
315
317
356...

output:

725
849
983
406
853
418
703
430
714
862
989
592
778
399
288
68
866
315
358
958
933
862
710
157
373
913
207
756
681
923
907
875
771
358
288
503
607
775
298
457
850
406
978
893
410
44
164
686
838
133
164
366
920
51
829
968
330
936
626
227
676
898
185
440
862
647
507
99
264
210
749
698
598
91
977
859
8...

result:

wrong answer Diff at 10-th number: read 862 but expected 874

Subtask #3:

score: 0
Wrong Answer

Test #17:

score: 0
Wrong Answer
time: 44ms
memory: 3744kb

input:

0
10
2 1000000
1 0
997 1000000
830 513
223 672
727 200
763 415
581 440
34 42
267 325
912 693
753 59
401 289
198 641
982 214
41 49
453 107
940 806
905 732
153 482
248 405
102 79
480 837
534 620
564 856
679 178
278 247
899 206
333 672
297 308
407 863
26 752
272 178
204 603
208 10
715 562
785 285
184 5...

output:

2
1
0
997
996
612
436
285
792
563
338
572
483
827
204
749
973
233
379
407
923
979
818
912
702
378
681
426
691
889
193
75
243
464
968
841
788
523
258
488
467
637
781
157
909
706
259
628
724
275
56
94
358
707
591
751
565
133
561
129
913
65
254
148
277
295
251
0
850
930
512
876
63
228
861
291
821
1
853...

input:

1
59859
4 0 2
3
9
0 1 1
1
0 1 1
1
968 914 2
967
969
800 698 2
799
801
737 139 2
736
738
1 0 1
0
7 9 2
6
8
877 671 2
876
878
1 0 1
0
1 0 1
0
0 1 1
1
1 0 2
0
2
962 689 2
961
963
628 786 2
627
629
488 496 2
487
489
2 8 2
1
3
0 1 1
1
570 360 2
569
571
83 96 2
82
84
447 421 2
446
448
709 330 2
708
710
88...

output:

3
1
1
967
799
736
0
8
876
0
0
1
0
961
629
489
3
1
569
84
446
708
885
880
0
172
361
191
1
1
245
9
461
2
1
1
374
673
211
0
489
187
895
357
1
2
175
408
117
0
866
2
636
420
34
44
0
79
2
1
1
4
4
55
604
169
75
2
679
7
731
340
47
2
572
1
227
245
0
716
1
71
480
0
0
705
0
719
0
306
54
5
1
1
826
2
1
0
699
0
9...

result:

wrong answer Diff at 14-th number: read 961 but expected 963

Subtask #4:

score: 0
Wrong Answer

Test #34:

score: 0
Wrong Answer
time: 46ms
memory: 3832kb

input:

0
10
2 1000000000
0 1
2 1000000000
0 1
2 1000000000
1 0
2 1000000000
1 0
2 1000000000
0 1
2 1000000000
1 0
2 1000000000
1 0
2 1000000000
0 1
2 1000000000
0 1
2 1000000000
0 1

output:

2
1
0
2
1
0
2
1
0
2
1
0
2
1
0
2
1
0
2
1
0
2
1
0
2
1
0
2
1
0

input:


output:


result:

wrong output format Output file not found: ""

Subtask #5:

score: 0
Channel 1 Judgement Failed

Test #54:

score: 0
Channel 1 Judgement Failed

input:


output:


input:


output:


result: