QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#507528#8029. Traveling Merchantforest114514TL 133ms23740kbC++143.0kb2024-08-06 18:59:102024-08-06 18:59:11

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 14904kb

input:

2
4 4
LHLH
0 1
1 2
1 3
2 3
3 3
LHH
0 1
0 2
1 2

output:

yes
no

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 52ms
memory: 15596kb

input:

12385
9 29
LHLLHLHLH
0 7
1 4
4 6
2 0
4 2
6 5
8 4
7 1
2 6
7 3
7 2
8 7
1 3
5 3
0 8
4 0
0 5
8 1
8 6
3 2
0 1
1 2
6 3
2 5
6 0
3 0
5 4
4 3
7 5
7 15
LLLLLHL
5 2
6 3
3 0
0 6
4 5
1 4
6 1
0 5
3 4
5 6
1 0
2 6
0 2
4 2
0 4
6 6
LHHHHH
5 0
0 4
2 5
1 4
1 3
3 4
9 8
LHLHLLHLL
5 7
5 4
7 4
7 8
1 5
0 1
1 8
1 2
5 4
LHHHH...

output:

yes
yes
no
no
no
yes
yes
yes
no
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
no
no
no
yes
no
no
yes
yes
no
no
yes
no
no
yes
yes
yes
yes
yes
yes
no
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
no
yes
yes
no
yes
yes
yes
yes
yes
yes
no
no
no
yes
yes
yes
no
yes
yes...

result:

ok 12385 lines

Test #3:

score: 0
Accepted
time: 26ms
memory: 14400kb

input:

4627
11 51
LLHLLLHHLHL
0 2
0 9
10 0
4 8
3 5
4 7
6 1
1 2
2 6
5 8
5 0
7 3
4 0
2 9
2 3
6 0
8 1
5 2
6 9
0 1
10 1
1 7
5 6
1 5
1 9
4 3
9 3
3 10
6 3
10 6
0 8
7 2
8 6
4 10
8 3
7 9
10 2
8 10
8 2
1 3
5 7
3 0
7 6
0 7
10 9
9 5
1 4
5 4
10 5
9 4
7 8
15 97
LLLLLHHHHLHHLHH
8 6
13 7
10 1
7 1
4 3
8 12
14 2
14 8
14 12...

output:

yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
y...

result:

ok 4627 lines

Test #4:

score: 0
Accepted
time: 19ms
memory: 14792kb

input:

2443
18 20
LHLLLLLLHLHHLHHHLH
13 11
15 0
16 8
9 8
15 12
13 3
6 12
15 8
2 16
6 10
11 7
2 6
8 12
5 6
2 11
12 0
16 1
1 0
16 3
14 15
16 116
LLHLLLLLHHHLLHLH
2 6
14 12
2 13
5 2
10 14
0 14
10 3
6 8
13 4
3 9
15 5
10 8
6 10
1 15
0 13
13 7
15 0
12 1
6 7
9 7
11 6
14 8
15 7
11 2
9 15
0 12
10 11
15 4
1 4
2 0
12...

output:

yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
y...

result:

ok 2443 lines

Test #5:

score: 0
Accepted
time: 19ms
memory: 15740kb

input:

1538
25 261
LHHLHLLHHLLLLLLHLHLLHHLLL
12 7
10 7
22 15
12 9
19 7
13 21
5 23
17 11
15 10
0 23
7 17
16 9
14 21
1 19
2 12
8 16
13 19
10 6
23 14
3 21
9 11
9 21
18 14
16 22
21 2
19 17
9 7
11 5
3 1
1 11
24 5
18 8
23 13
15 7
7 21
16 11
19 0
18 19
11 15
8 21
2 13
19 21
18 16
13 16
23 18
4 23
9 20
18 6
3 23
1...

output:

yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
y...

result:

ok 1538 lines

Test #6:

score: 0
Accepted
time: 20ms
memory: 14252kb

input:

1025
27 199
LHLHHLHLLLHLLHLHHLLHHHHHLHH
20 19
16 22
14 9
20 24
25 20
16 6
24 16
5 26
12 10
15 20
17 11
6 24
18 22
0 4
6 21
7 24
23 10
11 18
0 3
2 26
16 4
14 25
14 16
5 10
21 26
19 26
24 21
19 14
12 13
12 6
17 7
18 21
14 1
15 9
5 24
20 8
5 6
20 7
0 24
23 13
19 9
22 15
4 24
25 8
10 1
16 25
12 3
24 2
3...

output:

yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
ye...

result:

ok 1025 lines

Test #7:

score: 0
Accepted
time: 17ms
memory: 15916kb

input:

727
32 448
LHLHLLHHLHLHHLLLLLHLHLHLHHHHLLHL
17 18
11 26
8 4
3 20
0 3
21 0
26 20
2 9
30 24
6 26
15 5
8 18
6 2
10 25
3 12
12 19
30 25
21 29
9 26
30 13
6 23
13 23
30 23
19 0
3 30
17 7
5 16
13 0
25 17
10 9
25 7
0 17
22 19
9 30
17 28
20 1
20 17
14 25
14 17
31 15
31 12
21 8
23 27
8 16
19 26
4 2
20 13
31 1...

output:

yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
...

result:

ok 727 lines

Test #8:

score: 0
Accepted
time: 16ms
memory: 15856kb

input:

543
37 213
LLLLHHHLHHHHLLLLHHHLHLLHLLHHLLHHLHLHH
15 18
24 17
11 19
11 13
33 22
0 30
14 35
8 32
16 22
4 34
13 5
10 33
16 18
1 27
0 27
4 2
11 23
6 0
4 9
0 28
27 32
10 9
36 8
14 8
21 22
0 24
24 14
36 30
0 16
18 5
16 7
34 2
30 10
31 21
26 11
27 35
3 22
12 10
36 14
21 26
7 33
21 23
15 14
8 0
12 36
5 29
2...

output:

yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
y...

result:

ok 543 lines

Test #9:

score: 0
Accepted
time: 16ms
memory: 14024kb

input:

456
45 119
LLLLHLHHLLLHHLLHLHHLHLLHLLHHHLLHLLLHHHHHHHLHH
41 31
9 11
30 12
27 23
20 36
20 24
1 37
34 29
22 30
16 18
33 3
21 7
21 38
18 2
36 6
31 36
39 28
26 7
9 20
20 41
17 33
17 21
25 37
26 42
27 30
11 40
36 0
26 19
23 30
2 23
37 6
8 17
4 8
28 19
8 24
29 20
35 33
4 16
4 21
28 7
44 22
17 15
27 13
8 1...

output:

yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
y...

result:

ok 456 lines

Test #10:

score: 0
Accepted
time: 15ms
memory: 15644kb

input:

340
50 473
LLHLLHLHHLHLLLLHHLHLHHHLHHLHHHLLLLHHLLLLLLHHHHHHHH
33 43
35 23
30 19
7 33
1 22
20 36
0 41
15 10
19 49
38 30
39 47
17 12
30 47
0 7
8 26
26 36
10 14
44 1
30 41
4 29
33 10
37 12
48 25
30 15
38 21
49 43
7 17
39 15
18 27
8 13
19 36
5 28
20 49
4 14
38 32
12 8
40 18
12 30
12 45
43 10
20 8
19 4
2...

output:

yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
y...

result:

ok 340 lines

Test #11:

score: 0
Accepted
time: 11ms
memory: 15956kb

input:

257
50 755
LHHHHHLHHHHLHHLHLLLHLHHHHHHHLHHLLHHHLHHHHHLLHHHLLL
31 22
6 17
43 6
24 29
19 3
2 38
43 24
25 14
29 21
10 5
35 48
43 14
8 37
18 25
22 34
34 8
6 1
48 43
26 43
12 27
26 42
18 48
12 46
1 8
29 14
32 5
19 30
13 22
39 5
2 21
8 7
31 25
46 21
48 34
41 30
36 45
47 20
16 43
16 7
15 47
19 34
35 42
42 ...

output:

yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
y...

result:

ok 257 lines

Test #12:

score: 0
Accepted
time: 21ms
memory: 14160kb

input:

49
1001 4001
LHHHHLHHHHLLHHLHHLHHHHHHLHHLLLLLHLHLHLLLLLHHHHHHHLLHLHLHLLHHHLHHHLHLLHHHHHHLHLLHLLHLHHLHHHLHLHLHLHLLLHHHLHLHHLLLLLLLHHLLHHLHHHLHHLLLHLLHHLHLHHHHLHHHHLLHHHHHLLHLHLHHHHHLLLHLLHLLLHLLHHHHLHHHLLHHLHHLLHHLHHLLLHLLHLHHLHLHLLHLLLLLHLLLLLHHLLLLLHLHLHHHHLHLLHLHLLHLLHLLHHLHHHHLHHLLLHHHLHLLHLLLLLL...

output:

yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes

result:

ok 49 lines

Test #13:

score: 0
Accepted
time: 51ms
memory: 14904kb

input:

39
2000 5000
LLLHLLLLHLHLHLLLLLHHLHLLHHLHHHLHLLLLLLHLLHHLLHHLLHHLLHLHHLLLHHLLLHLHLLHHHLLLHLHLLLLLLHLLHLLHHLLLHHHHLLLLHLLLHLLLLHHLHHHHHHLHLHLHLHHLHLHHHLHHHHHLLLHLHHHHLHLHLHLLHLLHHLHLLHLLLLLHLLHLHHHHHLLLLHLLLHHLHLLLLLHHLLHHLHLHLLLLLHLHHLHHHLHLLHLHHLHHLHHLLLHLLHHHLHHLHLLLLHHLHLLLHLHLHLHLLLHHHHLHLHLHLLL...

output:

yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
no
no
yes
yes
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
yes

result:

ok 39 lines

Test #14:

score: 0
Accepted
time: 92ms
memory: 15228kb

input:

33
3002 6002
LHHLHHHHHHHLHLLLLHHLHHHHHHHHLHLLHLHHLHHLHLHLLHHHHHLHLHHHLHHLHHLLHLLLLHHLLHHHLLHHLLHHLHLHHHHHLHHLHLHLHLLHHHLHHLHLHHLLLLHHLLHHHHHLLLLLHLLHLHLHLHLLLHHHLHHLHHLHHHLHLLHHLHLHLLLHHLHHLLHLHLLHHLHLLHHLHHLHHLLLHLLHHHLLLLHHLHHLLHHHLHHHHLLLHHHHLHHHHHHLLHHHHLLHHLHHLLHLLLLLLLHLHLLHHHLLLLLLLLLLHLLHLLH...

output:

yes
yes
no
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
no
yes
yes
no
yes
yes
no

result:

ok 33 lines

Test #15:

score: 0
Accepted
time: 89ms
memory: 14516kb

input:

28
4004 7004
LLLLHHHLHLHHHHLHHHLHLHLLLHLLHLLHLLHHHHLLHHHHHLLHHLHLHHLLHLHHHHHLHHLHLLHLHLLHHLLHHLHHLLLHLHHHHLHHLHLHLHLLHHLHLLLHLHHLHHHLLHHLHLLHLHHHLLLHLLLLLHHHHHLLLLLLHHHHHLLLLLHHHLHHLHLHHHHLHHLLLLLHLHHLLLLHLHHHLHLLLLHLHLHLHLLHLLLHLLHLLHHLLLHLHLLLHHLLHHHHLLHLLHHLHLLLLLHHLLHLHHHLHHLHHHHLLHLLHLLHHHLLLLH...

output:

yes
yes
no
yes
yes
yes
yes
yes
no
yes
yes
yes
no
yes
yes
yes
no
yes
yes
yes
yes
yes
yes
no
no
yes
yes
yes

result:

ok 28 lines

Test #16:

score: 0
Accepted
time: 133ms
memory: 14956kb

input:

24
5000 8000
LHLLLHLHHHHHHHHLHHLHHLLHLHHLHHLHLLLLLHLHLLHLHLLLLHLHHLHLLLLLHHLHLLLHHLHHLHHHLLLLHLLHHLHLLLHHHLHLHLHLHLLHHLHLLLHHLHLLLHHLLLLLLLLHLLLHLLHHLHHLHLHHHLLHLHHHLHLHLHHLLHLHHHHLLHHHHLHLHHLLLHLHHLLLLHHHHHHLLHLHHLHHHHLHHHHHLHHLLHLLHLHHLHHLLLLLLHLLLLLHLHHHLLLHLHHHHLLHLLLLHLHHHHHHHLLLLLLHHLLHLLLLLLH...

output:

yes
no
no
yes
yes
no
yes
yes
yes
no
yes
no
no
yes
yes
yes
no
yes
yes
no
yes
yes
yes
yes

result:

ok 24 lines

Test #17:

score: 0
Accepted
time: 48ms
memory: 22928kb

input:

1
120000 199995
LLHLLHHLHLLHLHLHHLHHLLLHLHHLLLLHHHHLLHLLHLHHLLLLHHHHHHHLLLLLHLLHLHHLLHLHHHLLHLLHHLHLLLHHLLLHHHLHLLLHHHHHHHLHHHLHLLHHHHHHLHLLLLHLLLLHLHHLLLLHLHHHHHLLHLHHLHLLHLHLHHLLLLHLHHLHLLLHHHLLHHHHLHHHHHHHLLHLLLHHLHLHHLHLLLLLLHHLLHLHLLLLLLLLLLHHLHLLHLHLHHLLLLHLHHHHLHHHHHLLLLHHHLHHLHLLHHLLLHLLHLLH...

output:

yes

result:

ok single line: 'yes'

Test #18:

score: 0
Accepted
time: 56ms
memory: 23740kb

input:

1
119999 199994
LHHLLHLLHLHHLHLLHHLHLLHHHHHLLLLHHLLLLLHHLLHHLLLLLLLHLLHLHLHHHHLHHLHLLHLHLLLHLHHHLLLHLHHLHHHHLHHHHHLHLHHHLHHHLLLHLLLLHHHLHHLHHLLLLHHLHLHLLLLLHHHHLLLLLHHHHHHLLLHHHLHLLHLHHHLLLLLLHLLLHLLLLLLHHHLHHLLHHLHLHLHLHHHLLHHLLLLLLLLLHHHLLLHHLLLLHHHLLHLHLHLLLLHHLLHHHLHLHHLLHHHLHHLLLLLHLLHLHHLLLLLH...

output:

yes

result:

ok single line: 'yes'

Test #19:

score: 0
Accepted
time: 52ms
memory: 23512kb

input:

1
119998 199992
LLLHHLLHLHHHLHLLHHLHLHHHLLHLHLLLHHHLHHLLHLLHLHLHHLHHHLLHLLLHLHHLLLLLHHLHLLLLHLHHHLHLLHLLHLHLLHHHLHHHLHHHLLHLHLHHLHHLLLLHLHLHLLLLLLLHHLHHLHLHLLLLLLLHLHLLHLLLHLHHLHHLLHHLLHLLLLLLHLHHLLLLLLLHLLHHHLHLHHLLHLLHLLHLHLLLLLHHLHLLHHHLHHHLLLHLHHLLLLHHHHLHLLHHHLLLLHLHHHLLHLHHLLLHHLHHLLLHHLHHLHHL...

output:

yes

result:

ok single line: 'yes'

Test #20:

score: 0
Accepted
time: 56ms
memory: 23488kb

input:

1
119997 199992
LHHHLLLHLHHLLLHHLHLHHHHHLHLLHLHHHLHHHHHLHLHHLLHHHLHLHHLHHLHHLHHHHLLLHLLLLLLLHLHLHLLHLHLLHHLLHHHHHHHHHLHLHLHLLLLHHHHLHHHHLLHHLHLLLLLLLHHHHHLLLHHHHHHLLHLHHLLHLHLLLHLLLLLHHLLLHHLLHHHHHLLLHHHHHHHHLLHHLHLLHLHLLLHHHHHHHHLLLLHHLHLLLHHHLHLLHLLLLHLLLLHHLLHLLLLLHLLHLLHHHLHLLLHHLLHLHLLHLHLHHLHL...

output:

yes

result:

ok single line: 'yes'

Test #21:

score: 0
Accepted
time: 51ms
memory: 23556kb

input:

1
119996 199992
LHLHLHHHLHHLHHHLHLHHHHHHHHLLLHHLHHLHLLHLHLLLHHHLLLLLHHLHHHHLLHHLLLHLLLHLLLLLLLLHLLHHLLHLHHLLHHLLHHLHHLLHLLLHHLHLHHHHLLLLHLLHHLHHHLLHLLHHLLHHLLHHHHHLHLHLLLLHLLHHHHLLLLLHLHHHHLHHLLLHLHLLLHHHHHHHHHHHHHHLHHLHHLLHHHHLHLLLLLLHHLHHHHHLHLLHLHLHHLHHLLLHHLLLHLHLHHHLLHLLHHLLHHHHLLLHLLHLLHLHHHLL...

output:

yes

result:

ok single line: 'yes'

Test #22:

score: -100
Time Limit Exceeded

input:

1
200000 200000
LHHLHLLHHLHLLLHHLHHLHLHHHHLLHHLHLHHLHHLHHLHLLHHLHHHHHLLLLHHLHHHLHHHLLHHLHLHLLHLHLLHLLLLLHLLLLLLHHHHLHLLLLHHLLHHLLLLHHLHLHHHHLHHHHHHHHHLHHLLLHHLHHHLLHLLHLHLLLLLLLHHHLHLLLHHHHLHHHLLHLLHLLLHHHHLHHHLLHLLHHLHLLLLLHHHHLHLLHLLLLHHLLLHHLHHLHHHLLLHLHLHLLHLLLLHHHLLLHLLLLLLLLLLLLHHHLLLHLLHLLLHL...

output:


result: