QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#689998#1139. Stationssnpmrnhlol0 50ms4072kbC++171.6kb2024-10-30 19:38:082024-10-30 19:38:08

Judging History

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

  • [2024-10-30 19:38:08]
  • 评测
  • 测评结果:0
  • 用时:50ms
  • 内存:4072kb
  • [2024-10-30 19:38:08]
  • 提交

stations

#include "stations.h"
#include <vector>
#include <iostream>
using namespace std;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
    vector <vector<int>> e;
    vector<int> labels;
    e.resize(n);
    int cnt = 0;
    auto dfs = [&](auto self, int node, int p, int d) -> void{
        if(d == 0)labels[node] = cnt++;
        for(auto i:e[node]){
            if(i == p)continue;
            self(self, i, node, d^1);
        }
        if(d == 1)labels[node] = cnt++;
    };
	labels.resize(n);
	for(int i = 0;i < n - 1;i++){
        e[u[i]].push_back(v[i]);
        e[v[i]].push_back(u[i]);
	}
	for(int i = 0;i < n;i++){
        if(e[i].size() == 1){
            dfs(dfs, i, -1, 0);
            break;
        }
	}
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
    if(c.size() == 1)return c[0];
    int stl = 1000000,str = -1;
    if(s < c[0]){
        ///bot
        stl = s;
        for(auto i:c){
            str = max(str,i);
        }
        if(stl <= t && t <= str){
            return str;
        }else{
            int nr = 1000000;
            for(auto i:c){
                if(t <= i){
                    nr = min(nr, i);
                }
            }
            return nr;
        }
    }else{
        str = s;
        for(auto i:c){
            stl = min(stl,i);
        }
        if(stl <= t && t <= str){
            return stl;
        }else{
            int nr = -1;
            for(auto i:c){
                if(i <= t){
                    nr = max(nr, i);
                }
            }
            return nr;
        }
    }
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 28ms
memory: 4072kb

input:

0
10
10 1000
4 5
9 0
2 6
5 2
8 3
1 4
8 1
6 0
3 7
3 1000
0 1
1 2
998 1000
166 178
393 452
389 179
622 429
892 866
872 18
899 227
835 637
587 769
504 386
369 577
65 441
523 17
803 221
878 321
637 892
696 473
16 146
840 322
495 986
353 275
330 585
831 402
719 810
704 830
780 940
53 901
894 911
394 482
...

output:

10
4
8
3
9
2
7
6
0
1
5
3
0
2
1
998
109
886
915
992
254
408
815
813
66
57
833
733
40
604
304
33
774
135
340
738
566
708
217
654
201
643
359
481
409
160
894
578
597
647
488
828
227
944
423
544
870
3
844
986
157
516
120
945
811
239
704
928
543
286
292
546
2
68
865
234
99
439
937
876
79
20
38
916
279
49...

input:

1
59784
0 1 1
1
365 409 2
633
634
0 1 1
1
848 310 2
151
152
2 1 1
1
1 0 1
0
0 1 1
1
533 56 2
465
466
1 0 2
2
3
0 3 1
3
474 416 2
525
526
6 3 2
3
4
985 679 2
13
14
934 400 2
65
66
808 125 2
188
189
285 437 2
714
715
0 1 1
1
96 79 2
3
4
2 1 2
0
1
0 1 1
1
538 46 2
459
460
1 0 1
0
233 941 2
766
767
0 1 ...

output:

1
634
1
151
1
0
1
-1
2
3
525
3
13
65
-1
715
1
3
0
1
-1
0
1000000
1
2
1000000
1
0
0
238
49
1000000
1
6
19
0
804
-1
6
3
6
243
776
1000000
1000000
657
909
1000000
-1
6
2
-1
149
0
2
2
0
-1
2
4
0
0
803
269
-1
66
967
0
0
858
647
124
206
0
291
-1
2
0
1000000
1
1
1000000
2
284
2
61
80
-1
6
1000000
1000000
2...

result:

wrong answer Diff at 2-th number: read 634 but expected 633

Subtask #2:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 24ms
memory: 3760kb

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
4
515
771
5
260
516
3
132
259
387
514
643
770
898
962
6
69
133
196
261
324
388
451
517
580
644
707
772
835
899
2
37
68
100
131
164
195
227
258
292
323
355
386
419
450
482
513
548
579
611
642
675
706
738
769
803
834
866
897
930
961
985
977
7
22
38
53
70
85
101
116
134
149
165
180
197
212
228
243
...

input:

1
50252
733 385 1
731
856 134 1
855
972 527 1
973
413 389 1
412
861 226 1
859
425 928 1
424
711 717 1
709
438 782 1
436
716 757 3
717
718
722
874 467 3
867
868
871
972 19 1
973
600 147 3
601
602
603
786 520 1
784
407 926 1
405
295 4 1
294
75 151 1
74
868 935 3
869
870
874
323 314 3
261
293
308
365 6...

output:

731
855
973
412
859
424
709
436
1000000
-1
973
601
784
405
294
74
1000000
261
364
986
939
868
716
1000000
379
919
213
762
687
907
-1
884
777
364
-1
509
613
-1
304
463
1000000
412
-1
902
1000000
1000000
1000000
-1
844
1000000
1000000
372
926
57
838
981
336
942
1000000
1000000
685
904
191
446
868
653
...

result:

wrong answer Diff at 9-th number: read 1000000 but expected 722

Subtask #3:

score: 0
Wrong Answer

Test #17:

score: 0
Wrong Answer
time: 28ms
memory: 3788kb

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
0
1
997
565
306
218
854
396
715
169
286
755
583
102
622
443
880
807
793
468
440
409
523
351
189
656
213
651
485
900
959
875
232
551
576
394
735
129
244
763
678
606
918
475
353
867
314
362
859
28
47
179
643
701
621
714
930
716
932
473
964
127
74
858
849
871
0
425
532
256
505
965
114
566
851
586
996...

input:

1
59859
7 5 2
2
3
1 0 1
0
1 0 1
0
984 957 2
15
16
852 801 2
146
147
366 67 2
631
632
0 1 1
1
1 2 2
8
9
61 164 2
938
939
0 1 1
1
0 1 1
1
1 0 1
0
2 1 2
0
1
548 652 2
448
449
814 893 2
185
186
744 748 2
255
256
6 8 2
3
4
1 2 1
2
285 180 2
711
712
34 59 2
65
66
221 208 2
776
777
192 617 2
806
807
509 52...

output:

2
0
0
15
146
631
1
9
939
1
1
0
0
449
186
256
4
2
711
66
776
807
488
1000000
0
85
818
905
2
0
878
3
-1
3
0
0
814
162
102
0
1000000
907
1000000
-1
4
3
-1
203
489
0
886
3
769
661
91
21
1
32
0
0
2
8
8
-1
-1
-1
31
3
159
0
133
169
15
3
715
0
-1
376
0
359
2
32
1000000
1
1
1000000
1
186
1
652
79
0
2
2
866
7...

result:

wrong answer Diff at 1-th number: read 2 but expected 3

Subtask #4:

score: 0
Wrong Answer

Test #34:

score: 10
Accepted
time: 50ms
memory: 4056kb

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
0
1
2
0
1
2
0
1
2
0
1
2
0
1
2
0
1
2
0
1
2
0
1
2
0
1
2
0
1

input:

1
100000
1 0 1
0
0 1 1
1
0 1 1
1
1 0 1
0
0 1 1
1
1 0 1
0
1 0 1
0
1 0 1
0
1 0 1
0
1 0 1
0
0 1 1
1
1 0 1
0
0 1 1
1
1 0 1
0
0 1 1
1
0 1 1
1
0 1 1
1
1 0 1
0
1 0 1
0
0 1 1
1
1 0 1
0
0 1 1
1
0 1 1
1
1 0 1
0
1 0 1
0
0 1 1
1
0 1 1
1
1 0 1
0
0 1 1
1
0 1 1
1
1 0 1
0
1 0 1
0
1 0 1
0
1 0 1
0
1 0 1
0
0 1 1
1
1 0...

output:

0
1
1
0
1
0
0
0
0
0
1
0
1
0
1
1
1
0
0
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
1
0
1
0
0
0
1
1
0
1
1
1
1
0
0
1
1
0
0
0
1
1
0
1
1
0
1
1
0
0
0
1
0
1
1
1
1
1
1
0
1
0
1
1
1
0
0
0
0
1
0
0
1
0
1
1
0
1
1
1
0
0
0
1
1
1
0
1
0
0
1
0
1
0
1
1
0
0
1
0
0
0
1
1
1
0
0
0
1
1
0
0
1
1
1
0
1
0
1
0
1
1
1
1
0
0
0
0
1
0
0
1
0
0
0
...

result:

ok 

Test #35:

score: 0
Wrong Answer
time: 40ms
memory: 3724kb

input:

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

output:

3
0
1
2
3
2
0
1
3
2
0
1
3
0
1
2
3
0
2
1
3
0
2
1
3
0
1
2
3
0
2
1
3
2
0
1
3
0
1
2

input:

1
75069
2 1 2
0
1
2 1 2
0
1
0 1 1
2
0 1 1
2
1 2 1
2
0 1 1
2
1 2 1
2
2 0 2
0
1
1 0 1
2
2 1 2
0
1
2 1 2
0
1
1 0 1
2
2 1 2
0
1
2 1 2
0
1
1 0 1
2
0 1 1
2
2 0 2
0
1
2 1 2
0
1
0 2 1
2
1 2 1
2
2 1 2
0
1
2 1 2
0
1
0 2 1
2
1 2 1
2
0 2 1
2
1 0 1
2
0 2 1
2
1 2 1
2
1 0 1
2
2 0 2
0
1
2 1 2
0
1
2 1 2
0
1
2 0 2
0
...

output:

0
0
2
2
2
2
2
0
2
0
0
2
0
0
2
2
0
0
2
2
0
0
2
2
2
2
2
2
2
0
0
0
0
2
2
2
0
0
2
2
2
2
2
2
0
0
0
2
2
0
2
0
0
2
0
0
2
2
2
2
0
2
2
0
2
0
2
2
0
2
0
2
2
2
0
2
0
2
2
0
2
2
2
2
0
0
0
0
2
0
2
2
0
0
0
2
0
0
0
2
2
2
2
0
2
0
0
0
2
0
0
2
2
0
2
2
0
2
2
2
0
2
0
0
2
2
0
2
0
0
2
0
2
2
0
2
2
0
2
2
2
2
0
2
2
2
2
2
2
2
...

result:

wrong answer Diff at 1-th number: read 0 but expected 1

Subtask #5:

score: 0
Wrong Answer

Test #54:

score: 0
Wrong Answer
time: 36ms
memory: 3772kb

input:

0
10
3 1000000000
1 0
2 1
998 1000000000
928 443
90 795
55 379
957 417
759 300
960 136
309 858
833 370
228 827
876 955
619 365
15 108
243 388
54 925
141 894
272 634
0 989
600 346
380 277
350 113
326 613
975 946
660 98
34 538
220 864
9 585
185 860
458 424
509 14
22 275
109 872
153 233
76 834
972 736
...

output:

3
0
2
1
998
896
830
158
357
460
966
315
531
108
734
987
655
118
640
682
440
983
960
537
922
805
57
374
280
287
927
9
474
182
317
129
473
310
408
729
869
778
638
398
141
902
748
517
430
271
720
528
606
870
56
859
934
784
923
894
850
611
267
77
97
188
670
771
651
823
933
313
593
718
405
904
88
478
442...

input:

1
59797
1 2 2
2
3
886 933 2
113
114
1 0 1
0
42 74 2
57
58
862 460 2
136
137
3 0 2
0
1
3 2 2
0
1
837 689 2
160
161
472 271 2
526
527
786 861 2
210
211
0 1 1
1
128 124 2
871
872
181 817 2
818
819
125 222 2
872
873
2 0 2
0
1
663 964 2
333
334
742 541 2
257
258
87 80 2
12
13
4 5 2
5
6
912 677 2
87
88
47...

output:

3
114
0
1000000
136
0
0
160
526
211
1
871
819
873
0
334
257
12
6
87
528
0
2
719
6
546
417
475
325
1
0
106
382
2
372
85
944
505
-1
0
2
1
627
637
0
55
653
934
1000000
4
1
-1
111
0
6
621
156
1
491
3
0
1000000
1
7
-1
810
3
944
1000000
94
99
1000000
98
176
913
-1
0
462
1000000
305
2
963
2
2
5
-1
228
795
...

result:

wrong answer Diff at 1-th number: read 3 but expected 2