QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#135912#1139. Stationsbashkort#0 54ms3868kbC++201.2kb2023-08-06 15:29:212024-07-04 01:19:44

Judging History

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

  • [2024-07-04 01:19:44]
  • 评测
  • 测评结果:0
  • 用时:54ms
  • 内存:3868kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-06 15:29:21]
  • 提交

stations

#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
    vector<vector<int>> adj(n);
    for (int i = 0; i + 1 < n; ++i) {
        adj[u[i]].push_back(v[i]);
        adj[v[i]].push_back(u[i]);
    }
	std::vector<int> labels(n);
    int T = 0;
    auto dfs = [&](auto self, int v, int par) -> void {
        labels[v] += T++;
        for (int to : adj[v]) {
            if (to != par) {
                self(self, to, v);
            }
        }
        labels[v] += T * 1000;
    };
    dfs(dfs, 0, -1);
	return labels;
}

bool isp(int a, int b, int c, int d) {
    return a <= c && b >= d;
}

int find_next_station(int s, int t, std::vector<int> c) {
    int tins = s % 1000, touts = s / 1000, tint = t % 1000, toutt = t / 1000;
    if (isp(tins, touts, tint, toutt)) {
        for (int to : c) {
            if (isp(to % 1000, to / 1000, tint, toutt)) {
                return to;
            }
        }
    } else {
        for (int to : c) {
            if (isp(to % 1000, to / 1000, tins, touts)) {
                return to;
            }
        } 
    }
	return -1;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3656kb

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
10000
10006
10003
10008
10005
10004
10002
10009
10007
2001
3
3000
3001
3002
998
998000
998223
219053
219207
998508
998816
998365
998369
219086
219104
998329
998529
219138
998787
998608
219152
998447
998270
998680
998519
998863
998579
998434
998687
998402
998709
998718
998962
998818
998320
219011
...

input:

1
-1
0

output:


result:

FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)

Subtask #2:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 0ms
memory: 3660kb

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
996000
512001
996512
257002
512257
768513
996768
130003
257130
385258
512385
641514
768641
896769
996896
67004
130067
194131
257194
322259
385322
449386
512449
578515
641578
705642
768705
833770
896833
960897
996960
36005
67036
99068
130099
163132
194163
226195
257226
291260
322291
354323
385354...

input:

1
-1
0

output:


result:

FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)

Subtask #3:

score: 0
Wrong Answer

Test #17:

score: 0
Wrong Answer
time: 0ms
memory: 3576kb

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
2000
2001
997
997000
864251
864427
864578
864071
864300
864525
864291
864380
864036
864659
864114
997886
864630
864484
864456
997936
997880
864045
997947
864161
864485
864182
864437
864172
997970
864670
864788
864620
864399
997891
864022
864075
864340
864605
864375
864396
864226
864082
864706
9979...

input:

1
-1
0

output:


result:

FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)

Subtask #4:

score: 0
Wrong Answer

Test #34:

score: 10
Accepted
time: 54ms
memory: 3768kb

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
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001

input:

1
100000
2001 2000 1
2000
2000 2001 1
2001
2000 2001 1
2001
2001 2000 1
2000
2000 2001 1
2001
2001 2000 1
2000
2001 2000 1
2000
2001 2000 1
2000
2001 2000 1
2000
2001 2000 1
2000
2000 2001 1
2001
2001 2000 1
2000
2000 2001 1
2001
2001 2000 1
2000
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
20...

output:

2000
2001
2001
2000
2001
2000
2000
2000
2000
2000
2001
2000
2001
2000
2001
2001
2001
2000
2000
2001
2000
2001
2001
2000
2000
2001
2001
2000
2001
2001
2000
2000
2000
2000
2000
2001
2000
2001
2000
2000
2000
2001
2001
2000
2001
2001
2001
2001
2000
2000
2001
2001
2000
2000
2000
2001
2001
2000
2001
2001
...

result:

ok 

Test #35:

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

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
3000
3002
3001
3
3000
2001
3002
3
3000
3002
2001
3
3000
3002
3001
3
3000
3001
3002
3
3000
3001
3002
3
3000
3002
3001
3
3000
3001
3002
3
3000
3002
2001
3
3000
3002
3001

input:

1
75069
3001 3002 2
3000
3002
3000 2001 2
2001
3002
3000 3002 1
3001
3000 3002 1
3001
2001 3000 1
3000
3000 3002 1
3001
3002 3001 1
3001
3001 3000 2
3000
3002
2001 3002 1
3000
3001 3002 2
3000
3002
3001 3002 2
3000
3002
3002 3000 1
3001
3001 3002 2
3000
3002
3001 3002 2
3000
3002
3002 3000 1
3001
30...

output:

3000
2001
3001
3001
3000
3001
3001
3000
3000
3000
3000
3001
3000
3000
3001
3001
3000
2001
3001
3001
3000
3000
3000
3001
3001
3001
3001
3000
3001
3000
3000
2001
3000
3001
3000
3001
3000
2001
3001
3000
3001
3001
3000
3001
3000
3000
3002
3001
3000
3000
3001
3000
3000
3001
3002
3002
3001
3001
3000
3001
...

result:

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

Subtask #5:

score: 0
Wrong Answer

Test #54:

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

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
3000
3001
3002
998
998000
998335
998316
998714
998920
204140
998630
998933
998216
998527
204182
998685
998236
998715
998631
998880
204174
204128
998921
204052
998385
204089
998748
998560
998574
204062
204185
998948
998364
998634
998258
998946
998620
998816
998537
998257
998439
998719
998796
998282...

input:

1
59797
4002 4003 2
4001
4003
760532 760626 2
760531
760533
2001 2000 1
2000
100084 100051 2
100083
100085
488214 999920 2
488213
488215
4001 4000 2
4000
4002
4001 4003 2
4000
4002
998321 998617 2
998320
998322
999944 999542 2
999943
999945
997575 997725 2
997574
997576
2000 2001 1
2001
760503 76051...

output:

4001
760531
2000
100083
488213
4000
4000
998320
999943
997574
2001
760502
760396
998249
3000
997328
1000514
100024
10007
1000174
1000941
2000
4001
999559
204189
1000905
999832
1000948
998650
2001
3000
1000212
997230
3001
760015
100029
204094
1000987
100068
2000
3001
2001
999741
997275
2000
760647
10...

result:

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