QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#51789#4860. Longest Common SubsequencelarryzhongAC ✓1542ms50584kbC++17584b2022-10-04 02:25:232022-10-04 02:25:25

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3556kb

input:

2
4 3 1024 1 1 1 1
3 4 1024 0 0 0 0

output:

0
3

result:

ok 2 number(s): "0 3"

Test #2:

score: 0
Accepted
time: 1542ms
memory: 50512kb

input:

1
1000000 1000000 999999937 0 0 11 1

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 1238ms
memory: 50584kb

input:

1
1000000 1000000 1000000000 0 0 2 1

output:

437492

result:

ok 1 number(s): "437492"

Test #4:

score: 0
Accepted
time: 62ms
memory: 3624kb

input:

1
1000000 1000000 1000000000 0 0 0 0

output:

1000000

result:

ok 1 number(s): "1000000"

Test #5:

score: 0
Accepted
time: 1ms
memory: 3572kb

input:

1000
3 1 6 0 5 3 4
12 1 3 2 0 2 2
2 10 1 0 0 0 0
8 1 1 0 0 0 0
5 10 1 0 0 0 0
3 3 9 0 8 2 7
7 2 5 0 4 2 4
2 2 3 1 2 2 1
13 17 4 3 3 3 3
6 9 6 0 4 5 3
5 21 9 1 6 2 0
5 2 8 6 0 4 1
21 7 10 5 3 6 7
23 11 2 1 0 0 1
14 3 10 5 4 6 3
3 33 8 0 7 3 0
2 4 5 4 0 2 0
43 3 9 2 6 8 4
10 10 4 3 2 0 1
16 32 2 1 1 1...

output:

1
1
2
1
5
2
2
2
13
6
5
2
7
11
3
3
2
3
10
16
3
15
3
1
1
12
12
11
2
1
15
4
3
7
1
7
3
15
3
6
3
1
1
16
1
2
9
9
0
0
1
1
2
0
5
1
6
6
1
5
3
1
6
3
7
16
13
4
4
4
3
5
12
2
8
7
1
8
6
11
5
1
5
4
6
5
3
3
3
7
3
6
5
2
8
4
14
8
6
1
15
1
2
4
3
5
7
3
1
2
3
1
4
1
2
2
2
10
0
2
3
12
4
2
1
25
9
12
1
1
1
2
6
1
7
1
3
1
7
1...

result:

ok 1000 numbers

Test #6:

score: 0
Accepted
time: 3ms
memory: 3508kb

input:

1000
14 6 7 1 1 5 5
6 2 6 3 2 5 2
13 10 5 0 2 1 4
7 2 1 0 0 0 0
7 18 2 1 0 0 1
22 1 8 7 1 6 4
15 1 3 2 1 1 1
3 14 4 3 2 0 1
21 5 4 1 0 1 2
4 8 3 2 2 2 2
12 3 9 4 6 3 2
13 16 1 0 0 0 0
12 21 9 0 1 8 5
2 1 8 1 0 1 5
8 51 10 7 0 6 8
6 1 5 0 3 1 4
3 18 5 0 0 4 2
8 32 8 4 2 0 2
20 6 5 4 0 3 3
20 2 9 0 4 ...

output:

6
2
10
2
7
1
1
3
5
4
3
13
11
0
8
1
3
8
6
2
3
10
7
4
3
2
1
9
4
0
1
2
2
3
3
3
1
19
13
2
16
20
14
4
7
3
7
3
4
4
13
7
5
2
7
5
2
1
2
8
1
3
1
1
15
4
6
6
1
2
2
7
0
2
4
6
8
4
6
3
2
8
7
16
3
6
4
12
16
13
4
3
1
2
6
11
8
9
8
13
1
1
1
1
7
6
7
1
2
1
4
0
4
4
3
2
9
1
3
5
3
8
6
14
7
3
2
1
2
0
2
2
7
2
3
9
1
6
2
3
1
...

result:

ok 1000 numbers

Test #7:

score: 0
Accepted
time: 5ms
memory: 3568kb

input:

1000
11 3 4 3 2 2 1
7 11 1 0 0 0 0
4 1 1 0 0 0 0
5 13 8 1 7 3 7
8 24 3 2 1 2 1
13 7 5 4 1 0 2
6 2 6 1 1 0 1
2 26 2 0 0 1 0
3 14 6 5 3 1 3
9 47 10 2 2 6 1
6 7 9 3 0 0 8
6 7 5 2 3 4 3
10 8 2 1 0 0 0
6 5 1 0 0 0 0
7 1 10 1 4 9 2
29 15 8 0 3 5 2
1 6 10 9 8 3 9
13 3 8 4 2 5 4
12 18 6 1 5 3 2
18 7 4 0 2 3...

output:

3
7
1
5
7
7
2
2
3
9
6
6
8
5
1
15
1
3
12
7
0
2
13
1
14
2
3
17
3
6
4
1
2
7
4
5
6
11
1
2
1
3
3
5
3
0
3
6
8
2
2
2
1
5
1
4
9
3
5
2
5
0
3
0
10
1
21
2
3
5
8
1
3
3
12
1
3
23
10
24
1
12
14
7
6
11
6
4
4
3
4
3
1
1
6
9
3
3
9
10
4
1
7
5
11
1
2
1
1
9
4
2
1
1
2
6
11
4
2
11
14
6
3
4
2
8
1
3
3
2
1
5
2
7
4
3
3
6
6
3
...

result:

ok 1000 numbers

Test #8:

score: 0
Accepted
time: 1ms
memory: 3564kb

input:

1000
33 16 5 3 1 0 0
45 2 10 7 5 5 5
16 8 5 0 3 2 3
13 4 5 0 2 0 1
4 12 4 2 2 0 0
22 6 1 0 0 0 0
12 17 3 2 0 2 2
5 1 1 0 0 0 0
12 12 10 3 7 9 2
2 1 7 3 2 3 5
5 1 7 1 4 3 6
1 6 10 1 9 3 9
16 2 3 2 0 2 2
5 1 4 0 3 2 2
12 7 4 0 2 0 0
2 21 4 0 1 3 1
1 3 1 0 0 0 0
11 3 3 1 0 2 0
2 23 5 2 3 0 3
3 1 8 2 1 ...

output:

16
2
8
4
4
6
12
1
12
0
1
1
2
1
7
2
1
3
2
1
1
1
9
3
3
6
4
1
6
10
2
1
7
3
1
4
1
2
1
1
6
9
7
9
3
3
1
1
9
5
4
3
3
1
1
1
2
7
4
5
1
10
14
3
2
4
3
12
1
4
5
0
3
8
1
7
5
2
7
6
6
11
1
5
4
7
1
7
5
4
4
6
2
6
11
9
8
0
4
2
7
1
2
7
1
3
2
3
3
13
4
3
12
12
1
1
2
2
2
18
22
1
3
9
1
14
2
1
9
1
3
6
5
2
8
1
1
9
6
1
1
4
7...

result:

ok 1000 numbers

Test #9:

score: 0
Accepted
time: 3ms
memory: 3556kb

input:

1000
5 9 6 5 1 2 1
15 7 5 4 4 3 1
6 22 8 5 6 0 1
10 41 1 0 0 0 0
3 8 1 0 0 0 0
3 10 5 0 4 1 4
8 25 10 2 1 6 8
10 4 7 4 5 4 0
12 25 1 0 0 0 0
10 1 3 2 1 1 2
13 8 8 7 2 2 3
16 7 7 0 1 2 5
19 1 1 0 0 0 0
30 3 9 5 6 5 5
3 7 5 0 4 1 2
3 7 1 0 0 0 0
1 2 6 0 2 3 0
4 4 4 0 1 0 1
2 3 4 2 3 2 3
1 1 4 3 2 3 3
...

output:

4
7
6
10
3
2
7
4
12
1
8
7
1
3
3
3
1
4
2
0
2
8
3
1
2
6
7
3
5
3
1
9
12
7
2
7
1
10
8
3
4
3
6
3
12
6
10
3
1
4
3
3
4
3
4
5
15
2
1
4
5
2
3
2
12
6
1
0
2
0
3
2
2
3
10
2
2
3
2
3
7
2
1
1
2
1
7
2
3
3
3
2
4
1
3
2
9
5
3
15
4
10
3
4
4
5
1
5
6
1
2
7
7
1
4
11
1
7
4
2
3
10
5
5
1
4
2
9
1
7
3
1
10
6
1
1
2
18
16
1
2
11...

result:

ok 1000 numbers

Test #10:

score: 0
Accepted
time: 5ms
memory: 3628kb

input:

1000
7 14 4 1 2 1 3
4 2 9 7 4 1 8
10 1 5 2 0 4 0
10 3 4 2 0 0 3
4 10 3 2 0 2 1
5 2 9 6 6 8 0
9 13 2 0 0 0 0
10 2 6 0 1 0 2
1 1 9 3 2 4 2
26 14 4 0 2 0 3
8 39 6 5 3 3 5
5 29 1 0 0 0 0
7 6 5 0 2 2 1
6 6 8 3 1 7 2
2 14 6 0 5 3 1
1 6 7 1 6 1 6
5 1 9 8 3 2 0
1 8 4 2 0 0 2
17 10 8 6 1 7 4
4 7 7 0 5 3 5
4 ...

output:

7
2
1
3
4
2
9
2
0
14
8
5
6
4
2
1
0
1
10
4
4
3
3
6
1
8
10
1
4
12
9
4
3
4
2
5
2
13
7
13
5
6
5
1
9
1
1
4
2
1
19
23
5
6
9
6
8
7
3
6
2
4
1
2
1
3
2
15
4
14
7
7
3
3
3
2
2
8
1
2
3
17
2
14
9
1
3
9
1
2
8
3
1
6
14
1
3
8
13
9
2
3
4
3
7
9
18
3
2
2
25
0
1
4
1
5
2
1
1
2
21
10
2
7
2
8
4
9
2
4
1
5
17
2
5
2
1
2
1
19
...

result:

ok 1000 numbers

Test #11:

score: 0
Accepted
time: 4ms
memory: 3636kb

input:

1000
11 17 364842564 82604785 37722477 127540201 348362558
1 9 901635804 270985425 297435912 869439619 220374725
2 1 37302871 5111534 30668704 32082155 31325822
3 4 99577587 77936588 43641803 21097237 21318455
8 5 712082931 351941911 501914122 261694155 309605826
14 6 651864103 92791431 550378703 26...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000 numbers

Test #12:

score: 0
Accepted
time: 283ms
memory: 3984kb

input:

1000
1209 987 999999937 291305504 0 68216322 530194456
2238 1471 999999937 76673153 0 341886819 860681688
873 419 999999937 589293002 0 55260699 22543183
61 2048 999999937 552210226 0 134882182 117614359
224 2146 999999937 766154827 0 729854833 937145275
552 1605 999999937 419027830 0 371762614 3161...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000 numbers

Test #13:

score: 0
Accepted
time: 427ms
memory: 6132kb

input:

100
9061 20999 999999937 826477073 0 976276173 745907744
2501 19362 999999937 572675777 0 952968022 202640042
17940 7222 999999937 640174501 0 354424767 107328583
12360 3249 999999937 190243697 0 278031114 383018510
43163 6201 999999937 548839274 0 367395998 137385764
14163 4696 999999937 772376900 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #14:

score: 0
Accepted
time: 677ms
memory: 13348kb

input:

10
57614 201647 999999937 341573321 0 419175243 223164026
74551 9126 999999937 882666158 0 607958120 989764309
43376 115407 999999937 895009360 0 731815180 833739060
51789 59509 999999937 259524677 0 419408925 263911926
152779 140117 999999937 693285102 0 127584127 882756530
59391 45747 999999937 92...

output:

0
0
0
0
0
0
0
0
0
0

result:

ok 10 numbers

Test #15:

score: 0
Accepted
time: 1533ms
memory: 50492kb

input:

1
1000000 1000000 999999937 250663119 0 119564793 257785165

output:

0

result:

ok 1 number(s): "0"