# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
781499 |
2023-07-13T06:59:46 Z |
vjudge1 |
JJOOII 2 (JOI20_ho_t2) |
C++17 |
|
1 ms |
340 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY 1000000000005
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mid (start+end)/2
#define mod 1000000007
int32_t main(){
faster
int n,k;cin>>n>>k;
string s;cin>>s;
int ger=OYY,cev=OYY;
bool stop=false;
for(int i=0;i<n;i++){
if(s[i]=='J'){
cev=0;
stop=false;
int say=0,tut=0;
for(int j=i;j<n;j++){
if(say==0 && s[j]=='J'){
tut++;
}
else if(say==1 && s[j]=='O'){
tut++;
}
else if(say==2 && s[j]=='I'){
tut++;
}
else cev++;
if(tut==k){
say=1;
}
else if(tut==2*k){
say=2;
stop=true;
break;
}
}
//cout<<cev<<endl;
}
if(stop)ger=min(ger,cev);
}
if(ger==OYY)ger=-1;
cout<<ger<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |