QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#499931#1139. StationsDan4Life0 44ms4080kbC++231.1kb2024-07-31 20:18:242024-07-31 20:18:25

Judging History

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

  • [2024-07-31 20:18:25]
  • 评测
  • 测评结果:0
  • 用时:44ms
  • 内存:4080kb
  • [2024-07-31 20:18:24]
  • 提交

stations

#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
using ll = long long;
using vi = vector<int>;
const int mxN = 1010;
int dfs_timer = 0;
vi labels, adj[mxN];

void dfs(int s, int p, int dep){
	if(!dep) labels[s] = dfs_timer++;
	else dfs_timer++;
	for(auto u : adj[s])
		if(u!=p) dfs(u,s,dep^1);
	if(dep) labels[s] = dfs_timer++;
	else dfs_timer++;
}

vi label(int n, int k, vi u, vi v) {
	labels.clear(); labels.resize(n,0); dfs_timer=0;
	for(int i = 0; i < n; i++) adj[i].clear();
	for(int i = 0; i < sz(u); i++){
		int a = u[i], b = v[i];
		adj[a].pb(b), adj[b].pb(a);
	}
	dfs(0,-1, 0); return labels;
}

int find_next_station(int s, int t, vi c) {
	if(sz(c)==1) return c[0];
	for(auto u : c) if(u==t) return u;
	if(s < c[0]){
		if(!s or (s<=t and t<=end(c)[-2]+1)){
			for(int i = 1; i < sz(c)-!!s; i++)
				if(c[i-1]<t and t<=c[i]) return c[i];
			return c[0];
		}
		return c.back();
	}
	if(c[0]<t and t<=s){
		for(int i = 1; i < sz(c)-1; i++)
			if(c[i]<=t and t<c[i+1]) return c[i];
		return c.back();
	}
	return c[0];
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

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
0
14
4
12
6
16
18
10
8
2
3
0
4
2
998
0
1990
384
230
726
1034
1848
1844
86
104
1884
1684
138
1426
826
152
1766
488
898
1694
1350
1634
652
1526
620
1504
936
1180
1036
538
426
1374
1412
1512
1194
1874
672
326
1064
1306
1958
212
1906
242
532
1250
458
324
1840
696
1626
358
1304
790
802
1310
214
82
194...

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: 3944kb

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
0
1022
1990
2
512
1024
1534
256
510
766
1020
1278
1532
1788
1988
4
130
258
384
514
640
768
894
1026
1152
1280
1406
1536
1662
1790
1916
66
128
192
254
320
382
446
508
576
638
702
764
830
892
956
1018
1088
1150
1214
1276
1342
1404
1468
1530
1598
1660
1724
1786
1852
1914
1956
1986
6
36
68
98
132
16...

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: 40ms
memory: 4044kb

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
2
997
0
1476
1300
578
1656
300
1202
1436
380
36
1068
114
1970
630
484
456
1920
1976
1682
1810
1566
1242
182
1290
172
1886
670
788
620
1328
1754
22
1652
340
1122
1352
396
226
82
706
1906
1570
604
1492
1588
588
920
958
1222
156
272
112
298
730
302
734
1910
798
1118
1012
586
568
612
864
1714
1792
1...

input:

1
59859
10 6 2
0
2
2 0 1
0
2 0 1
0
1968 1914 2
30
32
388 490 2
1798
1800
270 868 2
1734
1736
0 2 1
2
12 0 2
16
18
122 328 2
1876
1878
0 2 1
2
0 2 1
2
2 0 1
0
4 2 2
0
2
1760 174 2
1958
1960
1628 1786 2
370
372
1488 1496 2
510
512
8 18 2
2
4
2 4 1
4
1434 1224 2
292
294
46 196 2
182
184
560 586 2
1444
...

output:

2
0
0
32
1798
1734
2
18
1876
2
2
0
2
1960
370
510
2
4
294
184
1444
480
1882
1840
2
1060
526
696
4
2
642
0
546
6
0
2
1372
326
796
2
374
700
1876
642
4
6
1174
1272
1116
2
322
6
552
768
134
140
2
48
0
0
4
10
10
74
1492
830
54
6
320
12
268
1228
82
6
1570
2
1228
754
2
1580
4
936
1480
2
2
158
2
1718
2
130...

result:

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

Subtask #4:

score: 0
Wrong Answer

Test #34:

score: 10
Accepted
time: 44ms
memory: 4040kb

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

input:

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

output:

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

result:

ok 

Test #35:

score: 10
Accepted
time: 40ms
memory: 4048kb

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
2
4
3
0
2
4
3
0
4
2
3
0
2
4
3
0
4
2
3
0
4
2
3
0
2
4
3
0
4
2
3
0
4
2
3
0
2
4

input:

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

output:

2
2
4
4
0
4
4
0
0
2
2
4
2
2
4
4
0
2
4
4
2
2
0
4
4
4
4
0
4
0
2
2
0
4
0
4
0
2
4
0
4
4
0
4
0
0
4
4
0
0
4
2
0
4
4
4
4
4
0
4
2
4
4
2
0
2
0
4
2
4
2
4
4
4
2
4
0
0
0
2
0
0
4
0
0
0
2
4
4
0
4
4
2
2
2
4
2
0
2
4
0
0
4
0
0
2
0
2
4
0
2
4
4
0
4
4
0
4
4
4
4
0
2
2
0
4
4
4
2
0
4
0
4
0
2
4
4
2
4
4
0
4
2
4
0
0
0
4
4
4
...

result:

ok 

Test #36:

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

input:

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

output:

4
0
6
2
4
4
0
2
4
6
4
0
6
2
4
4
0
6
2
4
4
0
6
4
2
4
0
2
4
6
4
0
2
4
6
4
0
4
6
2
4
0
4
2
6
4
0
6
2
4

input:

1
66804
0 2 2
4
6
0 2 2
4
6
6 0 2
0
4
0 6 1
6
0 4 2
2
6
6 4 2
0
4
2 4 2
4
6
6 2 2
0
2
0 2 1
6
4 6 2
0
2
0 6 2
2
6
6 0 2
0
4
2 6 2
4
6
2 0 1
0
6 0 2
0
2
2 4 1
0
2 0 1
0
6 4 2
0
4
2 6 2
4
6
4 2 1
2
2 4 2
4
6
6 0 1
0
0 6 1
6
6 4 2
0
2
4 2 1
2
6 2 2
0
4
6 0 2
0
2
4 2 1
2
4 2 1
2
0 2 2
2
6
6 4 2
0
4
4 6 ...

output:

4
4
0
6
6
4
4
2
6
0
6
0
6
0
0
0
0
4
6
2
4
0
6
2
2
4
0
2
2
2
4
2
2
0
6
6
6
6
6
2
0
2
6
2
6
0
6
6
6
2
4
4
2
4
4
2
2
6
4
0
6
0
6
4
2
0
6
2
6
6
6
0
6
6
4
0
4
0
0
2
2
6
6
6
4
0
2
6
2
2
0
2
2
0
6
6
6
2
0
6
2
0
4
2
2
6
2
6
6
2
4
0
6
0
0
0
6
2
4
4
6
2
6
6
4
2
2
2
4
6
4
0
6
6
2
6
4
2
4
4
4
6
6
0
0
0
2
0
6
6
...

result:

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

Subtask #5:

score: 0
Wrong Answer

Test #54:

score: 0
Wrong Answer
time: 38ms
memory: 4080kb

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
4
2
998
0
538
1882
1484
1278
140
1568
1136
1982
730
182
888
1962
918
834
1318
174
128
1124
52
588
318
1450
1638
1624
62
222
1250
1834
1564
1940
1252
1578
1382
740
460
642
922
1402
1916
12
702
1164
1338
1656
758
1142
986
458
316
480
76
630
54
410
498
976
1664
358
398
1822
858
656
896
552
74
1572
...

input:

1
59797
2 4 2
4
6
532 626 2
986
988
2 0 1
0
128 64 2
96
98
214 1564 2
760
762
6 0 2
0
2
6 4 2
0
2
524 820 2
1876
1878
1540 1942 2
1430
1432
1564 1414 2
720
722
0 2 1
2
1016 1008 2
502
504
1122 394 2
396
398
1948 1754 2
452
454
4 0 2
0
2
1810 1208 2
474
476
1484 1082 2
514
516
38 52 2
186
188
10 12 2...

output:

4
986
0
96
762
0
2
1876
1430
722
2
504
396
454
0
476
516
186
12
176
1058
0
6
1048
218
1094
1652
1810
1546
2
0
214
376
4
1502
44
94
1746
144
0
4
2
1228
1864
0
872
1304
626
1030
10
2
106
980
0
16
1244
1074
2
1778
6
2
676
6
18
600
108
6
1250
232
4
10
1818
198
842
1824
1350
2
922
1182
1368
4
132
4
6
14
...

result:

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