QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#208351#2499. JJOOII 2Camillus#100 ✓66ms6052kbC++201.4kb2023-10-09 14:42:592024-07-04 02:17:29

Judging History

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

  • [2024-07-04 02:17:29]
  • 评测
  • 测评结果:100
  • 用时:66ms
  • 内存:6052kb
  • [2023-10-09 14:42:59]
  • 提交

answer

/// @author Camillus
#include <bits/stdc++.h>

using ll = long long;
using namespace std;

signed main() {
#ifndef LOCAL
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#else
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, k;
    cin >> n >> k;
    
    string s;
    cin >> s;

    map<char, vector<int>> p;

    p['J'] = vector<int>(n + 1);
    p['O'] = vector<int>(n + 1);
    p['I'] = vector<int>(n + 1);

    for (int i = 1; i <= n; i++) {
        p['J'][i] = p['J'][i - 1];
        p['O'][i] = p['O'][i - 1];
        p['I'][i] = p['I'][i - 1];
        p[s[i - 1]][i] += 1;
    }

    int ans = INT32_MAX;

    auto findK = [&p, &k](int i, char x) -> int {
        if (i <= 0 || p[x][i] < k) {
            return 0;
        }
        int l = 0, r = i;
        while (r - l > 1) {
            int m = (l + r) / 2;
            if (p[x][i] - p[x][m] >= k) {
                l = m;
            } else {
                r = m;
            }
        }
        return l + 1;
    };

    for (int r = 1; r <= n; r++) {
        int x = r;
        x = findK(r, 'I');
        x = findK(x - 1, 'O');
        x = findK(x - 1, 'J');
        if (x) {
            ans = min(ans, r - x + 1 - 3 * k);
        }
    }

    if (ans == INT32_MAX) {
        cout << -1 << '\n';
    } else {
        cout << ans << '\n';
    }
    return 0;
}

详细

Subtask #1:

score: 1
Accepted

Test #1:

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

input:

10 1
IJOIIJOJIJ

output:

0

result:

ok single line: '0'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

15 1
OOJIJOOJJIOOIOJ

output:

2

result:

ok single line: '2'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

21 1
IIOIJOJIJJIIIJOIIOJIO

output:

0

result:

ok single line: '0'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

21 1
JJJOJIIIJOJIIOIOJOJOI

output:

0

result:

ok single line: '0'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3768kb

input:

21 1
JIIJIIIJOIOOIIIIIJJOI

output:

0

result:

ok single line: '0'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

21 1
IIOIOOJOIIOOOJIOOJOIJ

output:

0

result:

ok single line: '0'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

21 2
OJOIJJOJOIJJJJIIIOJJO

output:

5

result:

ok single line: '5'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

21 3
JIJIJOIJOOIJJOOIOOIOI

output:

10

result:

ok single line: '10'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

21 3
IIIJOOIJIOJJIOOIJJIII

output:

-1

result:

ok single line: '-1'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

21 4
JJOJJIJJJOOIIOIIOOOIJ

output:

-1

result:

ok single line: '-1'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

21 7
IOJIIOOJIJIOOOOOIJJJJ

output:

-1

result:

ok single line: '-1'

Test #12:

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

input:

3 1
JOI

output:

0

result:

ok single line: '0'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

21 1
JJJJJJJOOOOOOOIIIIIII

output:

6

result:

ok single line: '6'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

21 7
JJJJJJJOOOOOOOIIIIIII

output:

0

result:

ok single line: '0'

Subtask #2:

score: 12
Accepted

Dependency #1:

100%
Accepted

Test #15:

score: 12
Accepted
time: 1ms
memory: 3808kb

input:

2575 1
JJJJJIOOOJOJOIIJJOJIOOOOJJIOIOOIJJJOJIIOIIIJIIJOJIJIIJIOJOIJJIIIJJJJOIOIOOIJOIIJOOOOIIOIIJOJIIIJJOIOIOOIIJJIIOIOIIIOJIIIOIIIIIOIJJJIJOIIIIIIOJOIIJIIOIOIIOOJIOIIJJIIOIJIJIOJIOJOOJIIJIOIOOJJIIOOJOOIJIOOJIJJIOJOIIIIIJJOIIIIOOIJIOJOJIOIOOJOJIIIJIOOOJIJOJJIOIIJOIIOOJIOJIJOJOOIIOIIOOIIIIOIOJIJIOIOI...

output:

0

result:

ok single line: '0'

Test #16:

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

input:

3000 1
OOIIIJOOOOIJIOIJIOIIJJOOOIOOOIIIJIIIOJIIOOIIOOIOJOOIIOJOIJJIJJJJJOIOOOJIIOJOJIIJIJIOOJJJJJIOOIJIIOOJJJJOJJIOOOJOIOOIIJOIOOOOIJOJIJJIIOJJIIIOJJIIIOOOOOJOOIIIOIOOIOJOOOOIJJIJJJIIOJJIJOIJJOIJJIIIOIJOJJJIOIOOIJOJJOJJJOIOJOOOOIOJOIOIIIOOJIJJOIJIIOOOIOOJOJIOOJJJIIIOJOOIJIJIOJJJJIJJOJJIIJOJIIIOOJOIO...

output:

0

result:

ok single line: '0'

Test #17:

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

input:

3000 1
JOJIIOOJIOIIJJOJIIJOOIJOIJIJOOOOOOIJOJIJJIOJJIJJJIJJOOJOJOIOJOJJOJIOJIOOJIJIJJIIIOOJIOIOOOOJIOJJOJJJJOOOOIOJOIOOIOIJJJJOIJJIOOJOJOOIOOOIOIOOJOJIIIJIIIIIOIJIIJIOIJJJJOOIOIOOOOOJJIJOOJJIJJJJIIIOIIIIOIJOOIOOIIJJJJIJOIOIIJOOIIJJJOJOOIIIJJJIOOIJJOIIIJIIOJIOOJIIOIJJOIIOIOJJOOJIJJIOOIIOIJIJJOIOJIIIJ...

output:

0

result:

ok single line: '0'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

1856 140
IOIJOIJOJOOOIIJIOIIOJJJIOOIOJIJJJOJOJOIJIJIIOJIIJJJOJIIJJOJIJIOOJJIJIJJOJJOJIJOOOIIJJOIIIIIJJJJJOJJJOJIOOIIJIOOIJOIJJIOIOJIOOJOOIOIIJOJOJIOIIIOIOJIOJIIIOOIJOIJJIJJJJJOJOIOIJIOOJOOIJJOJIOJJIIJJJJIIOIIOIIIOOJJJOJOOJJOOOOIOIJOIIIJIIOOOJOIJJJJIIIIIOIIOIOJJIIIIJIJOJOJOOJIJOOJOOIIJOJOIJOIIOIJJOJO...

output:

766

result:

ok single line: '766'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

3000 45
JOOIIJJOOOIIOIIIJJIOOOOIOOOIJIOIIIIJJJJJIOIIJJIJIOJJIIJOOIOJIOIJIOIOOJJOJOJOIJIJIIIIIOOOJJJIIIIIIIOJOJJIJIIOIIIIIOOOOOOJOIJIJOOJOJJOOIJOJIIOOJJJOJOOJJJOOOIIIJJJIOIOOJOIOIJIIJOIOIJOJJOIOIIOIIIIOOJOOIJJIOIJIIJOJIOIOIIOIJIIOOJOIOOOJJOJIJJJJJJOJIJIIIIIJJIIJIJIIOJIOIIOJOJOOOOOJJIJOOJOOIOOIJIOIIOJ...

output:

201

result:

ok single line: '201'

Test #20:

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

input:

3000 36
JIJJJIOJOOOIIIJIIOIJIJJOIJIIIJIOJIJOOOIIOJIJIOIOOOOJIIJJIJIJJOOOJIIOIIIOJIOIJIOIJJIIJIIOIOJJIJIOOIIJJIOIOOOJJJJJJOJOIIIJIOOOJIIIIJOJIOJOJOOJJOJIJIOOOOOOIOJJJJJOIIIIJIJJOOIIIOIIIJOIJIJOJJOIOJJOJIJOIIJJIIJIOIOIJJIIIOIJIOOJOJOOIOOOJJOJJJJOIJOOJJOOIJOJOIOOOOIIOOJOIOJJIJOIOOIOIIJJIIOIOOOOIIIOOJJJ...

output:

156

result:

ok single line: '156'

Test #21:

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

input:

3000 218
OOIIOJJOOOIJIIIJIIJJOJIIIOOOIIJOIIOOJJIOJIIIJOOIJJOOOJOJJJIOJOOOIJJIIIIOIJIOIJIIJIJJOJIIJIIJIJIIIJOOIOIJJJIJJIJOIJOOIIOJIOJOIJOIIJOJOJIOIIIJOIOJIOOJOOOJIJIJIOOIJOIJIJOJIIJJOIJOOIOIIOJOJJJJJOOJIOJIOOOJJIJOIJOJOOJOIOJIIIOIOIJJJJIIJOOOJOJJIIJIIJJJIIJIIOJOIIJIJIJJJJIIOOOOJOIOIOOIIOOIOOJOIIOOIIJ...

output:

1105

result:

ok single line: '1105'

Test #22:

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

input:

2759 309
OJIIOJJIIJIIJOOJJOIJIOOJIIJJJIOJOIIIJIJIIIJJJIIJOJJIOIIOOOJJIIOIJIJJJOIJOIJJOIOJIOIIJJOJOJOJOOOOIJJIIJIOOJIIJIOIIIOOJOOOJOJOJJOJIJJOOIOJOIJJIJJIIJJOJJJIOJIOOIOJOOJOIJIIOIJIOOJJIIIIIJOIIJIIJIJIIJJJIOOIJJIJOOJJOOJIJOJOJJIIOIOIIJIIJIJIJIIIOJJIOJIJIJIJIIJJJOOJJIJIJIOOJIOIOIOIOJJJOJOIIIJIOIIIJOJ...

output:

1804

result:

ok single line: '1804'

Test #23:

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

input:

1578 180
OOOOJIOIIJJJOIJJOJIIIOJOOOIIJOJJIJIJOIJJJJJJJOIOOOIOJOOIOJOOJIJOOOIOIOIJIIOJJOOOJJIIIJOJJOJOJJIIIJIJJJOJJOIOJJOIIOJIJJIIIIJJIIIJIIIOOOIOJOIIJJIOIIOJJOIIOIJJIIIIJIOIOOIOJIIOJJJJJOIOIIOOIIIJIOIOIOJJJIIOOIOOOOOOOIIIIOJJIOJJJJIIIIJJOIOJOIOOIIJOJJJIIIJOIIOJOJIJJOJIOIOIIOJIIOOJIOOIOIOOJIJIIOOIJIO...

output:

1027

result:

ok single line: '1027'

Test #24:

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

input:

3000 318
OJOJIOJOOOOJJOJIIJJOJIOJIJJJIJJJIOIIJJJJJOIJJOIOOJJJOOIJIIOOOJIOOJJIJIOIOOOIIOIIOJOOIOOOOOJJOJOJIJOJJIOOOIIIOJJJOOOIIJIIIOIIJIOIOOJIIJJOIIOOJJIIOOJOOOOIIJOIOOIIIJIJJOIJIIOOJJIIOIIOIOIOIIIOJOIOJOIOJJOIOOIOOIIJIIIJJOOJJIIOJJIOOOIOJOIJOIIJIIJJOOIIIJOOIJJJJJIOOOOIJIIJOOIJIOOOJIOOJOJJIJIOIIOJJJO...

output:

2032

result:

ok single line: '2032'

Test #25:

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

input:

3000 337
JJIIIJIJIJIIIJJOIIOJOOOIJOJJIJJOJIJOJOIIJIIIOIJIIIJIJJIOOOIOJIOJJIOIIIIIJJIJOIIIJIOIJOJIOIOOJJJOIOJIJIJOOIOOOOJJJOIOJJJOOIJOOIIOJOJOJOOIIOIOOJIOJOJJIOIIJJJJJOOJJIJOIOJOJOOOIJJJOOIIJOIOOIIIOIOOOIOOJOOOIJOIIOOJIJOJIIOIJOOOIJJIJIIIIIOJJJJJJJIIOIOJJIIIIIOJOOIJJIJIJOIIIIIIJOJJIIOOJOOIIIOJOOJJOJJ...

output:

1982

result:

ok single line: '1982'

Test #26:

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

input:

3000 326
JOIJJJIOJOJJOOJJJIIOIIJOOIOJJIIOJIIIOJOOOJJOIIIOIOOIIIOJJIIOOJOJJOIOOOIIJIJOIIOJOJJOJJIJOJJOIIIOIIJJIOIJJIOJJJIIJIIIJIOIOIIIJOOIJJOOIJIJOJOJJOOOIJJJOIIOOJIIIIJOIOJIJOIOJOJOOIJOOIOIOJIJOOIOIOIOJIOJIOJJIJIIJOJOIOIJJOOIJJJOJOJOOJJIIIOJIIOJIJOJOIOJJIIOIJIIIIOIIIJOJJIIIOOJJJJJIIJIJOIIIJOOJIOOOOO...

output:

2018

result:

ok single line: '2018'

Test #27:

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

input:

3000 329
OIOOOJJJOIJJIOOIOJJIIJIJJOIOIIIIOIOJOJJIOIIIOJJJJIOJOJJJOJIJJJJJIJIOOJIIJJJIOIOJJOIJOJOOJIIOOIJOOIIJIJIIJJJJJIIIOOIIJJOIIIOOJOJOOOJJJOIIOOJOJOOOIJJIOJIIIJJOIJJOOIJOIOJIIOOOIOJIOIJJOIIOIJJOOIOOIJIOJOJOJOIOOOOIOIOJJOIJJOOJIOOIOOOJIIJJOIIIJJOOJOJJOOOJOOIOOIJJIIIIIJIIOOOIIOOIIJIIIJOOOOOOJJIOOOO...

output:

1987

result:

ok single line: '1987'

Test #28:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

2913 317
JOOIIOOIOIOJOIJIJOOJOOJOIOJIOIJOOIIOJIIJOOOOOIIJOIIJIJOIIOJOJOIJIOJJOIOIOJOJIOOIIJJJIOIJIIOIOJIOJOIJJOJIIJIOJOOOIOOJOJJJOIJJJJJOOJJIJIIOIOJOOIJJIJIIIIOJJIJJJIOIJOJIIJJIOIJOOIJIJJJJOJIOJIJOIIOOJIIJOIOOOIIOJOJIJIJOIOJIIIOJOOJJJIOOOOJOIIJIIOIJJOJJJOOJOJIOIOJJOJOJJIIOIOOIIOOOOIIJJJIOIOJJOJJOIOI...

output:

-1

result:

ok single line: '-1'

Test #29:

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

input:

3000 323
JIOIJJJIJIIOIOIOJIOOJIIOIOJOJIJJIIIJJOIIJJOOJOIIOJJIJIIOOIIIJIIJJOOOOJIJOJOIJIIIIIIOOIJOIOOIIIJOIJIOJJOJJOOJOOJIJIOIOOIJIOIIIIJJOIOIIOJJJJOIJJIOOIOJJOIJOIJJIOIJJJJIIIOOIOOIIJJIIJOIOIJIIOJOIJJIOIJIJOOIIJJIJJJOOIIJJJIIIOJJJIJOIIIJJOOIOOJJIJJIJOIJJOJJJIOJIOOIJOOJJOOIJOIOJIIIIJJIOJJJOOJJOIJJJOJ...

output:

-1

result:

ok single line: '-1'

Test #30:

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

input:

3000 338
IJIOIIOJJOIOJOIIIIIJIIJJJOOJOJJOJOIJIIIJJIOJOJOJIIOIJJJJIIIIJJJJJIOIOIIJJIJIIOIOIOJOOOIOJOJIIOOJJIJJOJIOOJJJOIJJOIIJJJIOJOJOOOJJOJJOOJIOJOOJOJIIIIOIJIOJIOJOJIOOIIIIJOJOOOOJOIOJOIJOIJOOOOOJIJOJJJIJOOJIOJOOIOOIOOJJJOOJOIOIOJJOIJOIIJIIOOIOOJJIOOOJIJJIIOIIOIIJIOJJIJOIIJIOOOOOOOIOIIJJOJIOJIOJJJJ...

output:

-1

result:

ok single line: '-1'

Test #31:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

1398 374
JIIIIJIOOIOOJOJOIIIIJJIOOJOJJJOOOJOIJIOIJOIIOIJJOJIOIJIOOJIJIJOOIJJIOOIOOOOOIIIOIJIJOOIJIOJIOOJJOJIJIOIIJOIIIOOIIIOJIIOOIOJOIIJOIOJIOOJIIJIOJOOOJIOJOOJJJJOIOIIJJOJIOJIJIJJIOJJJIOJJIJOJJJOIIIIOIOJJOOOJOJJOIOJOOOJJIIIJOIIOOOOOIOJOJIJOOIJOJOJIIOOOIJOIOIIJIOIIJIOIJOJIIIJOJIOJIIIIOIJOIIOIOIOOJOI...

output:

-1

result:

ok single line: '-1'

Test #32:

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

input:

3000 572
OJJOJJOIJJJIIJJJOJOJJJJJOOOOJJJOJIOJJJOJJOJOOOJOIOOIJIIJOJJIJOJIIOOOIIJOIIOOOIIJIJJIJOOIJIOIIOIJOIJOJIJIIIJOJOIJIJOIIJJJJJJJJIIOOJIOOIIOIOIJIJJJJJJIIOOIOJOIOIJJOJJOIJIOOIIOIOOIJOIIIOOIIOJOIIJJOOIJOJIIIOOIJOOOOOJJIOOOIOJJJIOOIJIOIJOJJJIJIOOIIJIIJIOJJJOJIOOJJIOOJIJOIIJJOOJJOOJJOIOJJIJOIIJJIJJ...

output:

-1

result:

ok single line: '-1'

Test #33:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

3000 1
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...

output:

999

result:

ok single line: '999'

Test #34:

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

input:

3000 315
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...

output:

685

result:

ok single line: '685'

Test #35:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

3000 1000
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...

output:

0

result:

ok single line: '0'

Subtask #3:

score: 87
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #36:

score: 87
Accepted
time: 62ms
memory: 5564kb

input:

185893 1
OJJJJIJIJOOJOIJOIJJJJIIIJJJOJIIJOIIOOJOOOJJJIJJOIIOIIJIIIJOJJOIJIJIOIIOOJJIOIIJJOOOJJJIJJOIJJIIJIJIJOIIJIJIJOIJOJJIOIOIJOIJOJIOOIIOIOOOOOJOJOIIIOOJIJIIIJIIIJIOJIIOIOIJOIJIJIJOJIJJOJIIJOOIJJIIJIIIJIIIIIJOIJOJIIJIIOIIJOJOOJOOOOIJOIOIIIJIIOOIOOIJOJOIJJJOJOIIJJIOOJJOOJOOOIJIOOIOJIJIIIOJOIOJOIOI...

output:

0

result:

ok single line: '0'

Test #37:

score: 0
Accepted
time: 66ms
memory: 5924kb

input:

200000 1
JJJJJJJOJIIIOIJJJIIJOOIIOIJOOIOJIIJIJJIJJJOJIIJOJOOJOOJOJOOJIIIJIOOJOJIJIJJOOJOJOJOJOJOOIIOIIIOJIJJJJJJIOJIJJIOJJIJOJOIIJIJOJJOJIOOIJOOJOJIIOJJJJJJOIIOIOOIIIJIIOIOJIJJIOJIJJJOJOOOOOIIOOIOIOIIIOJOOOJOJJOJIIOOIIJOJJIOJIIIJIJOJIJOJOJOOIOIIJIIIJOOIIJJIOIIIOOOOJJJJIIOIIJIJOJJIOOOJJIIOOJOOJOIIOJO...

output:

0

result:

ok single line: '0'

Test #38:

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

input:

200000 1
JJIIOJJOIIOJIJIIOJOIOJJJJOOOOOJIJIIOJOIIOOOOOJOIOIOIOOOJIIIIJJOOIIJOOOJOIOJJIIJJOIOIOOIIJIIIOOIOJOOJJIOIIIJOJIJIJOIOOIOIIOIIOOIIOIIJIIIIJIOJJJOIIOJJIOOJOOJOIOIJOOOOJIJOOJIJIJOJIOOJJOJOJJOIIIOIJJIOIIJOIJJIJJOOJJJIJIJJJIIJOOOIOIOJIOJJIJOIIOIIJJOIOOIJIJOJIJIOJJOJJOJOIOIOOIIOOIOJOOIIJIIIJJOJOJI...

output:

0

result:

ok single line: '0'

Test #39:

score: 0
Accepted
time: 57ms
memory: 5836kb

input:

197953 4450
OOJJOOJJOOJJIJJJIJJIOIOJIOIIJJJJOOOOOIIJJJOJIIOIIJIIOOOIIIIIOOOOOIJOOJIIOIIIOIOOOJOJJOIJIOIOOOIJJOJJOOOIOIIOJOOIIJOJJJOOJOJJIOIOOJIJJIOIIIIJOJJJIIJOJOJJOIOJJIIIOJOJOJOOOJIJJIJOJIIIOJIJOIJJJOJIOOOOIIOJJJJJOJJOJIOOJIIOOIIJOOOOOIJJOJJJIJIJIOJJJOOIIJIOJJJOOOIOIOOIIIJOOIIIJOIOIOOIIIJOOOOIOOJO...

output:

25893

result:

ok single line: '25893'

Test #40:

score: 0
Accepted
time: 28ms
memory: 6000kb

input:

200000 18115
OIOOOIOOOIJOJJIOIIJJIIOOIIIJJIJIJIOIIJIOJIOOIOJJIIIIIIOJIOOJOOOIJOIOIIIIJOOIIJIIIJJIIOOIIJOIOIOOJOIIIIJJIOOJOJOIOJIOIIOOJOOJOIOOJIJOIJIIOIOOJIJIJIJJOJOOIJOJOIIJIJOJOOJOOJOIIIOIIIOIJIJJJIJOIOOOOJOJJOOOJIJJOJIOJOJIJJIJOIJJOJIIJJOIIJOIOIOOJOIOIJJOJIOIOJOJOIJJIIJIOJJIJIOIOOIOIJIOOOIJIIOOIJO...

output:

107455

result:

ok single line: '107455'

Test #41:

score: 0
Accepted
time: 50ms
memory: 5904kb

input:

200000 8727
JJOJIIOIJIJIOJIJJIOJJOIOOIOJOOJIIOOOIOOIOIOOIIJJJJOJJJIOIOIOIOOOJOOIJOJJJOOOJJOJIJIIIJOIJOIJIOOIJIIJIJJIIOOJJIOJJJIJIOOIOIOJIJJOOIOJOJIJJIOOIIOJIIIIJJIOJOOJJOOOJIOOIIOJJOJIIIOIOIJJOJOOJOIIJIJOJOIJOOOJJIIJOIIIJJJIIOJJOJOJIIOIIIIOIIJJOOIJJIIOIJOOJJIIIJIJIIOIIIIIIJIJIJIOOIJOOOJIOOJIIOIJIOJI...

output:

51704

result:

ok single line: '51704'

Test #42:

score: 0
Accepted
time: 64ms
memory: 6004kb

input:

200000 865
JOOOOIOJJOIIJIOOJOOJOIJJIIJIIIOJJJOOIJOJJJIOIIOOIOOIOIIIOOIOJOJJOOOJOIIIOIIIIOIOIOIIJJIOJIJIIJIOOIOJJOOOOIOIIIIJOIJJOOJOOOJOJIIIOIOIJIJJOOOJJOIOOOJJJOJIOJIOIJJJIOIJJOOOIJIIIJOIIJJIIOOIIJOJOJOIOOJOOIOOOJIOIOJJIOJIJIIIOJOJOOIIIIJIOJJIOIIOJOIJJJIIJIIJOJOIIJOOJJJJOOIOIIOJJIJJOOJIOIOIJIOOIOJJJ...

output:

4797

result:

ok single line: '4797'

Test #43:

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

input:

124248 13796
OOJJJIJIIIIIIIOJJOOIJJOIOIJOIJOOIJIIJJIOOIOJIJJIIJJJIOJJOJIOJOJOIIOJJIIJIJJOOOOIJOOIJIIIJOOOOOOJIOOIJJIIJOIIJJOJIOIIIIIJJOJJIOOJOOIOIOOJOIOOIOOIIOJOJJOJJOOOIJJIOIOOJOJOIIIJJJJIJOJIOJOIIOIIOJOJIJJJJJOIIOJJJIJIIIOOIOJIIIOIJJJIOOIOOOOJJIIJIJOIOOOJJOJIJOIIJIJJOOOIIIIOIOJOJOJOIJOIJIOJOOJOJOJ...

output:

82849

result:

ok single line: '82849'

Test #44:

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

input:

154837 17068
OIIJJJIJIJOJIJJIJJIJOJIOIIOOJOIOIJJJOIJOIJJIIJOIOIOIIOOJIIIJIJIJJIIJOJOOOOOJJJIOIIJIIIIJJOIOJOJJIJOIOIOJIJJOOJJIOOIJOJIOIOOIIIIJIJJOJIIOOJIIIOIOIJOJIIJOIOJOOOJJJOIJJOOJOIJIIIIIOIOJIJIOOIIOIOJOJIIIOIOOJOOIJJJJJOJJIIOOOOOIOIOIJJIJIOIIIOJOIJJOOOOOOOJIOIJIJIOIIJOOIOJIJIOOIIJJIJJOIOJIJOJIOII...

output:

103628

result:

ok single line: '103628'

Test #45:

score: 0
Accepted
time: 25ms
memory: 5844kb

input:

200000 22299
IOOIJIIIJIIOIJJIIJJIJJIOJIOOOIOJOOOOIIOIOJOIOJJIIOJOIOJJJOOJJOOJIIJIIOOIOIJJJJOIOOOJIIIJJJOIOIJOOOJOOIOOIJOJOJJOJJIOOJOIJOIOJJIIIJJJOOJJJIOIJJJJJJOIOIIJOOIIJJIJOIJOIIOJJIOOOJOJIJJIIIJOOOOOOOOOOOIIOOOOOOJIJOOOJOIIIOJJJJOOIOIOJOIOOIIJIIIIOIIOOOOOIIOOIJJIOJIJJOJOIIOOJOIJOIOJJIJIOOOIJOOOIJJ...

output:

133093

result:

ok single line: '133093'

Test #46:

score: 0
Accepted
time: 25ms
memory: 5828kb

input:

200000 22239
JJIIOOIOJIJOOIIJOIJOOIIOIOJIOJOJIIIOJOOIJIIIJJJIJIOOIIOOOJJIOOOIOJJIJJJIJOOOOJIJOJJIJIIOOIIIIJJJJJIOIOOIOIJJOOJIJJIJIJOIJJIIJOJOIJJOIIJOIJIJIOOIJOJJJIOJJIOIOOJIIJOJOOJIJOOJJOJOOOOOJIOOOJOOJJIIIOOJJIIJJJIIIOOJJJIIIOJIOJOOOJJIIOJIOIOJIOJOOOOOJJIIIIJIOOIJJOJIJIIOIJJJIOIIJJIOIIOJJOIIOIIJJIO...

output:

133268

result:

ok single line: '133268'

Test #47:

score: 0
Accepted
time: 25ms
memory: 5880kb

input:

200000 22186
IIJOOOOJIIJJOOIOIOOJOIJJJJIIIOJOJIOJJJJIJOOOOJOOOIJIIOOJIJOJOIOOJIJJOOIIIOIIJJIIOIOIJOOIOJJOIJIOOIOIIIOJJOJOJOOJOOOIOIOJJIJOJOIJJJJIIJOOJJIIIJJJIIIJOOJIOOJIJIOOIJIIJOJIJJJJJJOJIIJJIOJOIIOJJIOOIJOJJIJIJOIJIIOOOIIIIOIIOOJIOIOOIIIOJOJOJOIOJJIJJIJOOIIIOOJJJIIJOOOOOJIJJOIOOOJJOIIJIOJJIOOOJOO...

output:

133428

result:

ok single line: '133428'

Test #48:

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

input:

200000 22167
OJOJJIJOIIJOIOOOIIIOIOIJIJOIIOOJOJIJOIJIIOOOOJJIJIOIIIIIIOJIOIOJJIJIIJOOJOOJJIIIJIOIOJIOJIJIJOJOIJJIIIIJJJIJIOIIIOOJJOJIIIOIIOOJOJJJOIOJJJJIIOJOOOOIOIIIOIOJJOOOJOJJIIOIJOOJOJJJIOIOJIIOJIJIOOOOOOIJOJOOIJJIJIOOJOIIIOIOIOIIOIIOJOOJOOIJIOIOIJJOIIOIJIJJIJIIOOOIJIJOOOJOOJJJOIOJIOOIOOIJIJJIOJO...

output:

133489

result:

ok single line: '133489'

Test #49:

score: 0
Accepted
time: 13ms
memory: 4772kb

input:

132975 14785
JJJOIJOIIOIOJOOJJJOJOIIIOJIIIJJJOIJOOIIIOJJIIJOOOIIIJIJIJOIIOIJIJIJOIJIIIOJOJIOOJOJIIOIOJIJOIOOJOOIIIIIOIIOOIIOJOOOIIIIJIJOIJJJOJIOJJJIJJIOOIIIIOIJJIIIIJIOIIJJIOIIIOJOIIIOOOIOIIOOOOIOJIOIIOOOOIIIJJIIOIIOJJOIJJIIOJJJJOOIIOJJJIOIOJIIJIOIIJJJOOJOOIOOOJIIOIIJOJOJIIJOJIOIOIJOOIJIOIOJJOJIJJOJ...

output:

-1

result:

ok single line: '-1'

Test #50:

score: 0
Accepted
time: 25ms
memory: 6052kb

input:

200000 22148
IIOOIJIIJOOOOIJOIIOIIOIOIIJJOIOJOIIIIJJOOOJJJOJJIOIJIJOIOOIIIJIOOJJJJOOIJIOJJIIOJJIIIOOIIJJJOIJOJOIJJIJIJOIIIJIOJIIIIIOOOJOIJIJOOIIIOIOOJJOOOJJOIIJIOIIIIOJJJIJJJJIJOJJIJOJIJIOIOJOOOOOOOIJIIJOIJOOJIIIIIIIOJJIOIOOOJJOOJOOOIIOOJOOIJIOIJIIJJOIIOOJIJJIJOOJIJIIJOJJIOIIJIOIIOJOIJJOIOJJIIOIJIJI...

output:

-1

result:

ok single line: '-1'

Test #51:

score: 0
Accepted
time: 25ms
memory: 5836kb

input:

200000 22207
IOIOOJOOJJJOOIOJIJIIIJOOIIJIIJIJOOIJOJJIIJIJIJOOJOOIOOOOIOIOOOIIIOOOJOIJIOIJIOOIIIIIOJJOIJJIIJOOIOIIIIIOOJIIOOIIOIOJIIOJIIOJJJOIJIJIIJOJIIJIOJIIOOIIJIOJIJJJJOIIOOJIIOOOIOOOJIIJIIJOJJIIOIJOIOJOOJOJIOJOOJIJIIJIJJIIIJIOIIIJIIJIOJIJIOJJIOIOIOOOOIOOOIJIOIJOOJJOOJOIIIOOOJIOIOJIOJIOOJIJIOOIJOJ...

output:

-1

result:

ok single line: '-1'

Test #52:

score: 0
Accepted
time: 6ms
memory: 5736kb

input:

192355 55361
IOIOJJOOOJJOJOIOJOOIJJJJJJIOIOOOOOOOIJJJOIOJIJOJOIIJIOIOJOJJIOJIOOJJIOJIJJIIOIOIIJOIJJJIOJIOJIOIJIJIIJOOOOJOJIOJOJOJIJJOJOOIOJOIIIJJIOIJIJOIJOOOOIOOJOOJIIIIOJOOOOJIOJJIIOJIJJIJIIJJOOIOOIJIIOIIOOJJIJOJIOOIOJIJJIJJOOOOJOJJJIOOIJJJOIJIOOOJJOOJJIJOJJIJJJOOIJJOJOIJOIIOIOIJIOOJIIJIIIOOOIOOOOO...

output:

-1

result:

ok single line: '-1'

Test #53:

score: 0
Accepted
time: 10ms
memory: 5880kb

input:

200000 55061
JJOOOIJIJOIOIJOOIIOIJIIJJOIIOJJJJJJJJJIIOIOJOIOOJIJOJIIOIJOOJOJJJOJJOOOIIJIIOJJJOOIJIIIIIOIJIIIIOOJIJOOOIIOIOIIIIOOOOOIJIOJIIJJOIOIJJIJJOOIJJJJIIIOIIJIIIJIOOOOOOOJJOOJOIJIJOJJOJOIJOIJOOIIIOOJIJOOIIJIOJJIIJIOOOIOIJOJIOIOIIOJJOOOIOOJOJOJIOIOIIOJOIOOOJJJOOOIIJOIOOOIJOOIOJJOIJJJOOJOIIIJIOII...

output:

-1

result:

ok single line: '-1'

Test #54:

score: 0
Accepted
time: 22ms
memory: 5880kb

input:

199998 1
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...

output:

66665

result:

ok single line: '66665'

Test #55:

score: 0
Accepted
time: 12ms
memory: 5900kb

input:

199998 44588
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...

output:

22078

result:

ok single line: '22078'

Test #56:

score: 0
Accepted
time: 6ms
memory: 5936kb

input:

199998 66666
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...

output:

0

result:

ok single line: '0'

Extra Test:

score: 0
Extra Test Passed