QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#113117 | #2499. JJOOII 2 | lmeowdn | 100 ✓ | 60ms | 62560kb | C++14 | 1.9kb | 2023-06-16 14:43:57 | 2023-06-16 14:43:59 |
Judging History
answer
#include<bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
template<typename T,typename U>
T ceil(T x, U y) {return (x>0?(x+y-1)/y:x/y);}
template<typename T,typename U>
T floor(T x, U y) {return (x>0?x/y:(x-y+1)/y);}
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}
int popcnt(int x) {return __builtin_popcount(x);}
int popcnt(ll x) {return __builtin_popcountll(x);}
int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));}
int topbit(ll x) {return (x==0?-1:63-__builtin_clzll(x));}
int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));}
int lowbit(ll x) {return (x==0?-1:__builtin_ctzll(x));}
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
int read() {
int x=0,w=1; char c=getchar();
while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();}
return x*w;
}
const int N=2e5+9;
int lst[129],fj[N][25],fo[N][25],fi[N][25],n,k,ans;
char s[N];
void pre(int f[N][25],int x) {
rep(h,1,20) f[x][h]=f[f[x][h-1]][h-1];
}
int jmp(int f[N][25],int x,int k) {
rep(h,0,20) if(k&(1<<h)) x=f[x][h];
return x;
}
signed main() {
scanf("%d%d%s",&n,&k,s+1);
ans=n+1;
rep(i,1,n) {
fj[i][0]=lst['J'];
fo[i][0]=lst['O'];
fi[i][0]=lst['I'];
pre(fj,i), pre(fo,i), pre(fi,i);
lst[s[i]]=i;
}
rep(i,1,n) {
int pos=i;
pos=jmp(fi,pos,k-(s[pos]=='I'));
pos=jmp(fo,pos,k-(s[pos]=='O'));
pos=jmp(fj,pos,k-(s[pos]=='J'));
if(pos) ans=min(ans,i-pos+1-3*k);
}
if(ans==n+1) puts("-1");
else printf("%d\n",ans);
return 0;
}
詳細信息
Subtask #1:
score: 1
Accepted
Test #1:
score: 1
Accepted
time: 2ms
memory: 7800kb
input:
10 1 IJOIIJOJIJ
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 1ms
memory: 7772kb
input:
15 1 OOJIJOOJJIOOIOJ
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 0ms
memory: 7872kb
input:
21 1 IIOIJOJIJJIIIJOIIOJIO
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 2ms
memory: 9868kb
input:
21 1 JJJOJIIIJOJIIOIOJOJOI
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 2ms
memory: 7784kb
input:
21 1 JIIJIIIJOIOOIIIIIJJOI
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 2ms
memory: 7788kb
input:
21 1 IIOIOOJOIIOOOJIOOJOIJ
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 2ms
memory: 7876kb
input:
21 2 OJOIJJOJOIJJJJIIIOJJO
output:
5
result:
ok single line: '5'
Test #8:
score: 0
Accepted
time: 2ms
memory: 7792kb
input:
21 3 JIJIJOIJOOIJJOOIOOIOI
output:
10
result:
ok single line: '10'
Test #9:
score: 0
Accepted
time: 2ms
memory: 7728kb
input:
21 3 IIIJOOIJIOJJIOOIJJIII
output:
-1
result:
ok single line: '-1'
Test #10:
score: 0
Accepted
time: 2ms
memory: 7616kb
input:
21 4 JJOJJIJJJOOIIOIIOOOIJ
output:
-1
result:
ok single line: '-1'
Test #11:
score: 0
Accepted
time: 2ms
memory: 7600kb
input:
21 7 IOJIIOOJIJIOOOOOIJJJJ
output:
-1
result:
ok single line: '-1'
Test #12:
score: 0
Accepted
time: 2ms
memory: 7820kb
input:
3 1 JOI
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 1ms
memory: 7768kb
input:
21 1 JJJJJJJOOOOOOOIIIIIII
output:
6
result:
ok single line: '6'
Test #14:
score: 0
Accepted
time: 2ms
memory: 7852kb
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: 2ms
memory: 9844kb
input:
2575 1 JJJJJIOOOJOJOIIJJOJIOOOOJJIOIOOIJJJOJIIOIIIJIIJOJIJIIJIOJOIJJIIIJJJJOIOIOOIJOIIJOOOOIIOIIJOJIIIJJOIOIOOIIJJIIOIOIIIOJIIIOIIIIIOIJJJIJOIIIIIIOJOIIJIIOIOIIOOJIOIIJJIIOIJIJIOJIOJOOJIIJIOIOOJJIIOOJOOIJIOOJIJJIOJOIIIIIJJOIIIIOOIJIOJOJIOIOOJOJIIIJIOOOJIJOJJIOIIJOIIOOJIOJIJOJOOIIOIIOOIIIIOIOJIJIOIOI...
output:
0
result:
ok single line: '0'
Test #16:
score: 0
Accepted
time: 1ms
memory: 8144kb
input:
3000 1 OOIIIJOOOOIJIOIJIOIIJJOOOIOOOIIIJIIIOJIIOOIIOOIOJOOIIOJOIJJIJJJJJOIOOOJIIOJOJIIJIJIOOJJJJJIOOIJIIOOJJJJOJJIOOOJOIOOIIJOIOOOOIJOJIJJIIOJJIIIOJJIIIOOOOOJOOIIIOIOOIOJOOOOIJJIJJJIIOJJIJOIJJOIJJIIIOIJOJJJIOIOOIJOJJOJJJOIOJOOOOIOJOIOIIIOOJIJJOIJIIOOOIOOJOJIOOJJJIIIOJOOIJIJIOJJJJIJJOJJIIJOJIIIOOJOIO...
output:
0
result:
ok single line: '0'
Test #17:
score: 0
Accepted
time: 0ms
memory: 10136kb
input:
3000 1 JOJIIOOJIOIIJJOJIIJOOIJOIJIJOOOOOOIJOJIJJIOJJIJJJIJJOOJOJOIOJOJJOJIOJIOOJIJIJJIIIOOJIOIOOOOJIOJJOJJJJOOOOIOJOIOOIOIJJJJOIJJIOOJOJOOIOOOIOIOOJOJIIIJIIIIIOIJIIJIOIJJJJOOIOIOOOOOJJIJOOJJIJJJJIIIOIIIIOIJOOIOOIIJJJJIJOIOIIJOOIIJJJOJOOIIIJJJIOOIJJOIIIJIIOJIOOJIIOIJJOIIOIOJJOOJIJJIOOIIOIJIJJOIOJIIIJ...
output:
0
result:
ok single line: '0'
Test #18:
score: 0
Accepted
time: 2ms
memory: 9748kb
input:
1856 140 IOIJOIJOJOOOIIJIOIIOJJJIOOIOJIJJJOJOJOIJIJIIOJIIJJJOJIIJJOJIJIOOJJIJIJJOJJOJIJOOOIIJJOIIIIIJJJJJOJJJOJIOOIIJIOOIJOIJJIOIOJIOOJOOIOIIJOJOJIOIIIOIOJIOJIIIOOIJOIJJIJJJJJOJOIOIJIOOJOOIJJOJIOJJIIJJJJIIOIIOIIIOOJJJOJOOJJOOOOIOIJOIIIJIIOOOJOIJJJJIIIIIOIIOIOJJIIIIJIJOJOJOOJIJOOJOOIIJOJOIJOIIOIJJOJO...
output:
766
result:
ok single line: '766'
Test #19:
score: 0
Accepted
time: 1ms
memory: 8072kb
input:
3000 45 JOOIIJJOOOIIOIIIJJIOOOOIOOOIJIOIIIIJJJJJIOIIJJIJIOJJIIJOOIOJIOIJIOIOOJJOJOJOIJIJIIIIIOOOJJJIIIIIIIOJOJJIJIIOIIIIIOOOOOOJOIJIJOOJOJJOOIJOJIIOOJJJOJOOJJJOOOIIIJJJIOIOOJOIOIJIIJOIOIJOJJOIOIIOIIIIOOJOOIJJIOIJIIJOJIOIOIIOIJIIOOJOIOOOJJOJIJJJJJJOJIJIIIIIJJIIJIJIIOJIOIIOJOJOOOOOJJIJOOJOOIOOIJIOIIOJ...
output:
201
result:
ok single line: '201'
Test #20:
score: 0
Accepted
time: 0ms
memory: 8080kb
input:
3000 36 JIJJJIOJOOOIIIJIIOIJIJJOIJIIIJIOJIJOOOIIOJIJIOIOOOOJIIJJIJIJJOOOJIIOIIIOJIOIJIOIJJIIJIIOIOJJIJIOOIIJJIOIOOOJJJJJJOJOIIIJIOOOJIIIIJOJIOJOJOOJJOJIJIOOOOOOIOJJJJJOIIIIJIJJOOIIIOIIIJOIJIJOJJOIOJJOJIJOIIJJIIJIOIOIJJIIIOIJIOOJOJOOIOOOJJOJJJJOIJOOJJOOIJOJOIOOOOIIOOJOIOJJIJOIOOIOIIJJIIOIOOOOIIIOOJJJ...
output:
156
result:
ok single line: '156'
Test #21:
score: 0
Accepted
time: 2ms
memory: 8120kb
input:
3000 218 OOIIOJJOOOIJIIIJIIJJOJIIIOOOIIJOIIOOJJIOJIIIJOOIJJOOOJOJJJIOJOOOIJJIIIIOIJIOIJIIJIJJOJIIJIIJIJIIIJOOIOIJJJIJJIJOIJOOIIOJIOJOIJOIIJOJOJIOIIIJOIOJIOOJOOOJIJIJIOOIJOIJIJOJIIJJOIJOOIOIIOJOJJJJJOOJIOJIOOOJJIJOIJOJOOJOIOJIIIOIOIJJJJIIJOOOJOJJIIJIIJJJIIJIIOJOIIJIJIJJJJIIOOOOJOIOIOOIIOOIOOJOIIOOIIJ...
output:
1105
result:
ok single line: '1105'
Test #22:
score: 0
Accepted
time: 3ms
memory: 10076kb
input:
2759 309 OJIIOJJIIJIIJOOJJOIJIOOJIIJJJIOJOIIIJIJIIIJJJIIJOJJIOIIOOOJJIIOIJIJJJOIJOIJJOIOJIOIIJJOJOJOJOOOOIJJIIJIOOJIIJIOIIIOOJOOOJOJOJJOJIJJOOIOJOIJJIJJIIJJOJJJIOJIOOIOJOOJOIJIIOIJIOOJJIIIIIJOIIJIIJIJIIJJJIOOIJJIJOOJJOOJIJOJOJJIIOIOIIJIIJIJIJIIIOJJIOJIJIJIJIIJJJOOJJIJIJIOOJIOIOIOIOJJJOJOIIIJIOIIIJOJ...
output:
1804
result:
ok single line: '1804'
Test #23:
score: 0
Accepted
time: 1ms
memory: 7936kb
input:
1578 180 OOOOJIOIIJJJOIJJOJIIIOJOOOIIJOJJIJIJOIJJJJJJJOIOOOIOJOOIOJOOJIJOOOIOIOIJIIOJJOOOJJIIIJOJJOJOJJIIIJIJJJOJJOIOJJOIIOJIJJIIIIJJIIIJIIIOOOIOJOIIJJIOIIOJJOIIOIJJIIIIJIOIOOIOJIIOJJJJJOIOIIOOIIIJIOIOIOJJJIIOOIOOOOOOOIIIIOJJIOJJJJIIIIJJOIOJOIOOIIJOJJJIIIJOIIOJOJIJJOJIOIOIIOJIIOOJIOOIOIOOJIJIIOOIJIO...
output:
1027
result:
ok single line: '1027'
Test #24:
score: 0
Accepted
time: 3ms
memory: 12168kb
input:
3000 318 OJOJIOJOOOOJJOJIIJJOJIOJIJJJIJJJIOIIJJJJJOIJJOIOOJJJOOIJIIOOOJIOOJJIJIOIOOOIIOIIOJOOIOOOOOJJOJOJIJOJJIOOOIIIOJJJOOOIIJIIIOIIJIOIOOJIIJJOIIOOJJIIOOJOOOOIIJOIOOIIIJIJJOIJIIOOJJIIOIIOIOIOIIIOJOIOJOIOJJOIOOIOOIIJIIIJJOOJJIIOJJIOOOIOJOIJOIIJIIJJOOIIIJOOIJJJJJIOOOOIJIIJOOIJIOOOJIOOJOJJIJIOIIOJJJO...
output:
2032
result:
ok single line: '2032'
Test #25:
score: 0
Accepted
time: 2ms
memory: 9988kb
input:
3000 337 JJIIIJIJIJIIIJJOIIOJOOOIJOJJIJJOJIJOJOIIJIIIOIJIIIJIJJIOOOIOJIOJJIOIIIIIJJIJOIIIJIOIJOJIOIOOJJJOIOJIJIJOOIOOOOJJJOIOJJJOOIJOOIIOJOJOJOOIIOIOOJIOJOJJIOIIJJJJJOOJJIJOIOJOJOOOIJJJOOIIJOIOOIIIOIOOOIOOJOOOIJOIIOOJIJOJIIOIJOOOIJJIJIIIIIOJJJJJJJIIOIOJJIIIIIOJOOIJJIJIJOIIIIIIJOJJIIOOJOOIIIOJOOJJOJJ...
output:
1982
result:
ok single line: '1982'
Test #26:
score: 0
Accepted
time: 2ms
memory: 8084kb
input:
3000 326 JOIJJJIOJOJJOOJJJIIOIIJOOIOJJIIOJIIIOJOOOJJOIIIOIOOIIIOJJIIOOJOJJOIOOOIIJIJOIIOJOJJOJJIJOJJOIIIOIIJJIOIJJIOJJJIIJIIIJIOIOIIIJOOIJJOOIJIJOJOJJOOOIJJJOIIOOJIIIIJOIOJIJOIOJOJOOIJOOIOIOJIJOOIOIOIOJIOJIOJJIJIIJOJOIOIJJOOIJJJOJOJOOJJIIIOJIIOJIJOJOIOJJIIOIJIIIIOIIIJOJJIIIOOJJJJJIIJIJOIIIJOOJIOOOOO...
output:
2018
result:
ok single line: '2018'
Test #27:
score: 0
Accepted
time: 2ms
memory: 10128kb
input:
3000 329 OIOOOJJJOIJJIOOIOJJIIJIJJOIOIIIIOIOJOJJIOIIIOJJJJIOJOJJJOJIJJJJJIJIOOJIIJJJIOIOJJOIJOJOOJIIOOIJOOIIJIJIIJJJJJIIIOOIIJJOIIIOOJOJOOOJJJOIIOOJOJOOOIJJIOJIIIJJOIJJOOIJOIOJIIOOOIOJIOIJJOIIOIJJOOIOOIJIOJOJOJOIOOOOIOIOJJOIJJOOJIOOIOOOJIIJJOIIIJJOOJOJJOOOJOOIOOIJJIIIIIJIIOOOIIOOIIJIIIJOOOOOOJJIOOOO...
output:
1987
result:
ok single line: '1987'
Test #28:
score: 0
Accepted
time: 0ms
memory: 9936kb
input:
2913 317 JOOIIOOIOIOJOIJIJOOJOOJOIOJIOIJOOIIOJIIJOOOOOIIJOIIJIJOIIOJOJOIJIOJJOIOIOJOJIOOIIJJJIOIJIIOIOJIOJOIJJOJIIJIOJOOOIOOJOJJJOIJJJJJOOJJIJIIOIOJOOIJJIJIIIIOJJIJJJIOIJOJIIJJIOIJOOIJIJJJJOJIOJIJOIIOOJIIJOIOOOIIOJOJIJIJOIOJIIIOJOOJJJIOOOOJOIIJIIOIJJOJJJOOJOJIOIOJJOJOJJIIOIOOIIOOOOIIJJJIOIOJJOJJOIOI...
output:
-1
result:
ok single line: '-1'
Test #29:
score: 0
Accepted
time: 0ms
memory: 9740kb
input:
3000 323 JIOIJJJIJIIOIOIOJIOOJIIOIOJOJIJJIIIJJOIIJJOOJOIIOJJIJIIOOIIIJIIJJOOOOJIJOJOIJIIIIIIOOIJOIOOIIIJOIJIOJJOJJOOJOOJIJIOIOOIJIOIIIIJJOIOIIOJJJJOIJJIOOIOJJOIJOIJJIOIJJJJIIIOOIOOIIJJIIJOIOIJIIOJOIJJIOIJIJOOIIJJIJJJOOIIJJJIIIOJJJIJOIIIJJOOIOOJJIJJIJOIJJOJJJIOJIOOIJOOJJOOIJOIOJIIIIJJIOJJJOOJJOIJJJOJ...
output:
-1
result:
ok single line: '-1'
Test #30:
score: 0
Accepted
time: 3ms
memory: 10064kb
input:
3000 338 IJIOIIOJJOIOJOIIIIIJIIJJJOOJOJJOJOIJIIIJJIOJOJOJIIOIJJJJIIIIJJJJJIOIOIIJJIJIIOIOIOJOOOIOJOJIIOOJJIJJOJIOOJJJOIJJOIIJJJIOJOJOOOJJOJJOOJIOJOOJOJIIIIOIJIOJIOJOJIOOIIIIJOJOOOOJOIOJOIJOIJOOOOOJIJOJJJIJOOJIOJOOIOOIOOJJJOOJOIOIOJJOIJOIIJIIOOIOOJJIOOOJIJJIIOIIOIIJIOJJIJOIIJIOOOOOOOIOIIJJOJIOJIOJJJJ...
output:
-1
result:
ok single line: '-1'
Test #31:
score: 0
Accepted
time: 2ms
memory: 7796kb
input:
1398 374 JIIIIJIOOIOOJOJOIIIIJJIOOJOJJJOOOJOIJIOIJOIIOIJJOJIOIJIOOJIJIJOOIJJIOOIOOOOOIIIOIJIJOOIJIOJIOOJJOJIJIOIIJOIIIOOIIIOJIIOOIOJOIIJOIOJIOOJIIJIOJOOOJIOJOOJJJJOIOIIJJOJIOJIJIJJIOJJJIOJJIJOJJJOIIIIOIOJJOOOJOJJOIOJOOOJJIIIJOIIOOOOOIOJOJIJOOIJOJOJIIOOOIJOIOIIJIOIIJIOIJOJIIIJOJIOJIIIIOIJOIIOIOIOOJOI...
output:
-1
result:
ok single line: '-1'
Test #32:
score: 0
Accepted
time: 2ms
memory: 8020kb
input:
3000 572 OJJOJJOIJJJIIJJJOJOJJJJJOOOOJJJOJIOJJJOJJOJOOOJOIOOIJIIJOJJIJOJIIOOOIIJOIIOOOIIJIJJIJOOIJIOIIOIJOIJOJIJIIIJOJOIJIJOIIJJJJJJJJIIOOJIOOIIOIOIJIJJJJJJIIOOIOJOIOIJJOJJOIJIOOIIOIOOIJOIIIOOIIOJOIIJJOOIJOJIIIOOIJOOOOOJJIOOOIOJJJIOOIJIOIJOJJJIJIOOIIJIIJIOJJJOJIOOJJIOOJIJOIIJJOOJJOOJJOIOJJIJOIIJJIJJ...
output:
-1
result:
ok single line: '-1'
Test #33:
score: 0
Accepted
time: 1ms
memory: 8076kb
input:
3000 1 JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...
output:
999
result:
ok single line: '999'
Test #34:
score: 0
Accepted
time: 2ms
memory: 8092kb
input:
3000 315 JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...
output:
685
result:
ok single line: '685'
Test #35:
score: 0
Accepted
time: 2ms
memory: 8124kb
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: 36ms
memory: 61048kb
input:
185893 1 OJJJJIJIJOOJOIJOIJJJJIIIJJJOJIIJOIIOOJOOOJJJIJJOIIOIIJIIIJOJJOIJIJIOIIOOJJIOIIJJOOOJJJIJJOIJJIIJIJIJOIIJIJIJOIJOJJIOIOIJOIJOJIOOIIOIOOOOOJOJOIIIOOJIJIIIJIIIJIOJIIOIOIJOIJIJIJOJIJJOJIIJOOIJJIIJIIIJIIIIIJOIJOJIIJIIOIIJOJOOJOOOOIJOIOIIIJIIOOIOOIJOJOIJJJOJOIIJJIOOJJOOJOOOIJIOOIOJIJIIIOJOIOJOIOI...
output:
0
result:
ok single line: '0'
Test #37:
score: 0
Accepted
time: 35ms
memory: 62512kb
input:
200000 1 JJJJJJJOJIIIOIJJJIIJOOIIOIJOOIOJIIJIJJIJJJOJIIJOJOOJOOJOJOOJIIIJIOOJOJIJIJJOOJOJOJOJOJOOIIOIIIOJIJJJJJJIOJIJJIOJJIJOJOIIJIJOJJOJIOOIJOOJOJIIOJJJJJJOIIOIOOIIIJIIOIOJIJJIOJIJJJOJOOOOOIIOOIOIOIIIOJOOOJOJJOJIIOOIIJOJJIOJIIIJIJOJIJOJOJOOIOIIJIIIJOOIIJJIOIIIOOOOJJJJIIOIIJIJOJJIOOOJJIIOOJOOJOIIOJO...
output:
0
result:
ok single line: '0'
Test #38:
score: 0
Accepted
time: 34ms
memory: 62468kb
input:
200000 1 JJIIOJJOIIOJIJIIOJOIOJJJJOOOOOJIJIIOJOIIOOOOOJOIOIOIOOOJIIIIJJOOIIJOOOJOIOJJIIJJOIOIOOIIJIIIOOIOJOOJJIOIIIJOJIJIJOIOOIOIIOIIOOIIOIIJIIIIJIOJJJOIIOJJIOOJOOJOIOIJOOOOJIJOOJIJIJOJIOOJJOJOJJOIIIOIJJIOIIJOIJJIJJOOJJJIJIJJJIIJOOOIOIOJIOJJIJOIIOIIJJOIOOIJIJOJIJIOJJOJJOJOIOIOOIIOOIOJOOIIJIIIJJOJOJI...
output:
0
result:
ok single line: '0'
Test #39:
score: 0
Accepted
time: 43ms
memory: 62264kb
input:
197953 4450 OOJJOOJJOOJJIJJJIJJIOIOJIOIIJJJJOOOOOIIJJJOJIIOIIJIIOOOIIIIIOOOOOIJOOJIIOIIIOIOOOJOJJOIJIOIOOOIJJOJJOOOIOIIOJOOIIJOJJJOOJOJJIOIOOJIJJIOIIIIJOJJJIIJOJOJJOIOJJIIIOJOJOJOOOJIJJIJOJIIIOJIJOIJJJOJIOOOOIIOJJJJJOJJOJIOOJIIOOIIJOOOOOIJJOJJJIJIJIOJJJOOIIJIOJJJOOOIOIOOIIIJOOIIIJOIOIOOIIIJOOOOIOOJO...
output:
25893
result:
ok single line: '25893'
Test #40:
score: 0
Accepted
time: 47ms
memory: 62472kb
input:
200000 18115 OIOOOIOOOIJOJJIOIIJJIIOOIIIJJIJIJIOIIJIOJIOOIOJJIIIIIIOJIOOJOOOIJOIOIIIIJOOIIJIIIJJIIOOIIJOIOIOOJOIIIIJJIOOJOJOIOJIOIIOOJOOJOIOOJIJOIJIIOIOOJIJIJIJJOJOOIJOJOIIJIJOJOOJOOJOIIIOIIIOIJIJJJIJOIOOOOJOJJOOOJIJJOJIOJOJIJJIJOIJJOJIIJJOIIJOIOIOOJOIOIJJOJIOIOJOJOIJJIIJIOJJIJIOIOOIOIJIOOOIJIIOOIJO...
output:
107455
result:
ok single line: '107455'
Test #41:
score: 0
Accepted
time: 46ms
memory: 62484kb
input:
200000 8727 JJOJIIOIJIJIOJIJJIOJJOIOOIOJOOJIIOOOIOOIOIOOIIJJJJOJJJIOIOIOIOOOJOOIJOJJJOOOJJOJIJIIIJOIJOIJIOOIJIIJIJJIIOOJJIOJJJIJIOOIOIOJIJJOOIOJOJIJJIOOIIOJIIIIJJIOJOOJJOOOJIOOIIOJJOJIIIOIOIJJOJOOJOIIJIJOJOIJOOOJJIIJOIIIJJJIIOJJOJOJIIOIIIIOIIJJOOIJJIIOIJOOJJIIIJIJIIOIIIIIIJIJIJIOOIJOOOJIOOJIIOIJIOJI...
output:
51704
result:
ok single line: '51704'
Test #42:
score: 0
Accepted
time: 46ms
memory: 62420kb
input:
200000 865 JOOOOIOJJOIIJIOOJOOJOIJJIIJIIIOJJJOOIJOJJJIOIIOOIOOIOIIIOOIOJOJJOOOJOIIIOIIIIOIOIOIIJJIOJIJIIJIOOIOJJOOOOIOIIIIJOIJJOOJOOOJOJIIIOIOIJIJJOOOJJOIOOOJJJOJIOJIOIJJJIOIJJOOOIJIIIJOIIJJIIOOIIJOJOJOIOOJOOIOOOJIOIOJJIOJIJIIIOJOJOOIIIIJIOJJIOIIOJOIJJJIIJIIJOJOIIJOOJJJJOOIOIIOJJIJJOOJIOIOIJIOOIOJJJ...
output:
4797
result:
ok single line: '4797'
Test #43:
score: 0
Accepted
time: 27ms
memory: 43808kb
input:
124248 13796 OOJJJIJIIIIIIIOJJOOIJJOIOIJOIJOOIJIIJJIOOIOJIJJIIJJJIOJJOJIOJOJOIIOJJIIJIJJOOOOIJOOIJIIIJOOOOOOJIOOIJJIIJOIIJJOJIOIIIIIJJOJJIOOJOOIOIOOJOIOOIOOIIOJOJJOJJOOOIJJIOIOOJOJOIIIJJJJIJOJIOJOIIOIIOJOJIJJJJJOIIOJJJIJIIIOOIOJIIIOIJJJIOOIOOOOJJIIJIJOIOOOJJOJIJOIIJIJJOOOIIIIOIOJOJOJOIJOIJIOJOOJOJOJ...
output:
82849
result:
ok single line: '82849'
Test #44:
score: 0
Accepted
time: 16ms
memory: 55792kb
input:
154837 17068 OIIJJJIJIJOJIJJIJJIJOJIOIIOOJOIOIJJJOIJOIJJIIJOIOIOIIOOJIIIJIJIJJIIJOJOOOOOJJJIOIIJIIIIJJOIOJOJJIJOIOIOJIJJOOJJIOOIJOJIOIOOIIIIJIJJOJIIOOJIIIOIOIJOJIIJOIOJOOOJJJOIJJOOJOIJIIIIIOIOJIJIOOIIOIOJOJIIIOIOOJOOIJJJJJOJJIIOOOOOIOIOIJJIJIOIIIOJOIJJOOOOOOOJIOIJIJIOIIJOOIOJIJIOOIIJJIJJOIOJIJOJIOII...
output:
103628
result:
ok single line: '103628'
Test #45:
score: 0
Accepted
time: 45ms
memory: 62472kb
input:
200000 22299 IOOIJIIIJIIOIJJIIJJIJJIOJIOOOIOJOOOOIIOIOJOIOJJIIOJOIOJJJOOJJOOJIIJIIOOIOIJJJJOIOOOJIIIJJJOIOIJOOOJOOIOOIJOJOJJOJJIOOJOIJOIOJJIIIJJJOOJJJIOIJJJJJJOIOIIJOOIIJJIJOIJOIIOJJIOOOJOJIJJIIIJOOOOOOOOOOOIIOOOOOOJIJOOOJOIIIOJJJJOOIOIOJOIOOIIJIIIIOIIOOOOOIIOOIJJIOJIJJOJOIIOOJOIJOIOJJIJIOOOIJOOOIJJ...
output:
133093
result:
ok single line: '133093'
Test #46:
score: 0
Accepted
time: 45ms
memory: 62468kb
input:
200000 22239 JJIIOOIOJIJOOIIJOIJOOIIOIOJIOJOJIIIOJOOIJIIIJJJIJIOOIIOOOJJIOOOIOJJIJJJIJOOOOJIJOJJIJIIOOIIIIJJJJJIOIOOIOIJJOOJIJJIJIJOIJJIIJOJOIJJOIIJOIJIJIOOIJOJJJIOJJIOIOOJIIJOJOOJIJOOJJOJOOOOOJIOOOJOOJJIIIOOJJIIJJJIIIOOJJJIIIOJIOJOOOJJIIOJIOIOJIOJOOOOOJJIIIIJIOOIJJOJIJIIOIJJJIOIIJJIOIIOJJOIIOIIJJIO...
output:
133268
result:
ok single line: '133268'
Test #47:
score: 0
Accepted
time: 54ms
memory: 62560kb
input:
200000 22186 IIJOOOOJIIJJOOIOIOOJOIJJJJIIIOJOJIOJJJJIJOOOOJOOOIJIIOOJIJOJOIOOJIJJOOIIIOIIJJIIOIOIJOOIOJJOIJIOOIOIIIOJJOJOJOOJOOOIOIOJJIJOJOIJJJJIIJOOJJIIIJJJIIIJOOJIOOJIJIOOIJIIJOJIJJJJJJOJIIJJIOJOIIOJJIOOIJOJJIJIJOIJIIOOOIIIIOIIOOJIOIOOIIIOJOJOJOIOJJIJJIJOOIIIOOJJJIIJOOOOOJIJJOIOOOJJOIIJIOJJIOOOJOO...
output:
133428
result:
ok single line: '133428'
Test #48:
score: 0
Accepted
time: 47ms
memory: 62484kb
input:
200000 22167 OJOJJIJOIIJOIOOOIIIOIOIJIJOIIOOJOJIJOIJIIOOOOJJIJIOIIIIIIOJIOIOJJIJIIJOOJOOJJIIIJIOIOJIOJIJIJOJOIJJIIIIJJJIJIOIIIOOJJOJIIIOIIOOJOJJJOIOJJJJIIOJOOOOIOIIIOIOJJOOOJOJJIIOIJOOJOJJJIOIOJIIOJIJIOOOOOOIJOJOOIJJIJIOOJOIIIOIOIOIIOIIOJOOJOOIJIOIOIJJOIIOIJIJJIJIIOOOIJIJOOOJOOJJJOIOJIOOIOOIJIJJIOJO...
output:
133489
result:
ok single line: '133489'
Test #49:
score: 0
Accepted
time: 28ms
memory: 45752kb
input:
132975 14785 JJJOIJOIIOIOJOOJJJOJOIIIOJIIIJJJOIJOOIIIOJJIIJOOOIIIJIJIJOIIOIJIJIJOIJIIIOJOJIOOJOJIIOIOJIJOIOOJOOIIIIIOIIOOIIOJOOOIIIIJIJOIJJJOJIOJJJIJJIOOIIIIOIJJIIIIJIOIIJJIOIIIOJOIIIOOOIOIIOOOOIOJIOIIOOOOIIIJJIIOIIOJJOIJJIIOJJJJOOIIOJJJIOIOJIIJIOIIJJJOOJOOIOOOJIIOIIJOJOJIIJOJIOIOIJOOIJIOIOJJOJIJJOJ...
output:
-1
result:
ok single line: '-1'
Test #50:
score: 0
Accepted
time: 53ms
memory: 62416kb
input:
200000 22148 IIOOIJIIJOOOOIJOIIOIIOIOIIJJOIOJOIIIIJJOOOJJJOJJIOIJIJOIOOIIIJIOOJJJJOOIJIOJJIIOJJIIIOOIIJJJOIJOJOIJJIJIJOIIIJIOJIIIIIOOOJOIJIJOOIIIOIOOJJOOOJJOIIJIOIIIIOJJJIJJJJIJOJJIJOJIJIOIOJOOOOOOOIJIIJOIJOOJIIIIIIIOJJIOIOOOJJOOJOOOIIOOJOOIJIOIJIIJJOIIOOJIJJIJOOJIJIIJOJJIOIIJIOIIOJOIJJOIOJJIIOIJIJI...
output:
-1
result:
ok single line: '-1'
Test #51:
score: 0
Accepted
time: 60ms
memory: 62416kb
input:
200000 22207 IOIOOJOOJJJOOIOJIJIIIJOOIIJIIJIJOOIJOJJIIJIJIJOOJOOIOOOOIOIOOOIIIOOOJOIJIOIJIOOIIIIIOJJOIJJIIJOOIOIIIIIOOJIIOOIIOIOJIIOJIIOJJJOIJIJIIJOJIIJIOJIIOOIIJIOJIJJJJOIIOOJIIOOOIOOOJIIJIIJOJJIIOIJOIOJOOJOJIOJOOJIJIIJIJJIIIJIOIIIJIIJIOJIJIOJJIOIOIOOOOIOOOIJIOIJOOJJOOJOIIIOOOJIOIOJIOJIOOJIJIOOIJOJ...
output:
-1
result:
ok single line: '-1'
Test #52:
score: 0
Accepted
time: 42ms
memory: 61456kb
input:
192355 55361 IOIOJJOOOJJOJOIOJOOIJJJJJJIOIOOOOOOOIJJJOIOJIJOJOIIJIOIOJOJJIOJIOOJJIOJIJJIIOIOIIJOIJJJIOJIOJIOIJIJIIJOOOOJOJIOJOJOJIJJOJOOIOJOIIIJJIOIJIJOIJOOOOIOOJOOJIIIIOJOOOOJIOJJIIOJIJJIJIIJJOOIOOIJIIOIIOOJJIJOJIOOIOJIJJIJJOOOOJOJJJIOOIJJJOIJIOOOJJOOJJIJOJJIJJJOOIJJOJOIJOIIOIOIJIOOJIIJIIIOOOIOOOOO...
output:
-1
result:
ok single line: '-1'
Test #53:
score: 0
Accepted
time: 39ms
memory: 62276kb
input:
200000 55061 JJOOOIJIJOIOIJOOIIOIJIIJJOIIOJJJJJJJJJIIOIOJOIOOJIJOJIIOIJOOJOJJJOJJOOOIIJIIOJJJOOIJIIIIIOIJIIIIOOJIJOOOIIOIOIIIIOOOOOIJIOJIIJJOIOIJJIJJOOIJJJJIIIOIIJIIIJIOOOOOOOJJOOJOIJIJOJJOJOIJOIJOOIIIOOJIJOOIIJIOJJIIJIOOOIOIJOJIOIOIIOJJOOOIOOJOJOJIOIOIIOJOIOOOJJJOOOIIJOIOOOIJOOIOJJOIJJJOOJOIIIJIOII...
output:
-1
result:
ok single line: '-1'
Test #54:
score: 0
Accepted
time: 27ms
memory: 62468kb
input:
199998 1 JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...
output:
66665
result:
ok single line: '66665'
Test #55:
score: 0
Accepted
time: 26ms
memory: 62512kb
input:
199998 44588 JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...
output:
22078
result:
ok single line: '22078'
Test #56:
score: 0
Accepted
time: 22ms
memory: 62492kb
input:
199998 66666 JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...
output:
0
result:
ok single line: '0'
Extra Test:
score: 0
Extra Test Passed