Submission #960899

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9608992024-04-11 07:57:34AlgorithmWarriorJJOOII 2 (JOI20_ho_t2)C++14
100 / 100
11 ms1408 KiB
#include <bits/stdc++.h>
#define MAX 200005
using namespace std;
int vj[MAX],vo[MAX],vi[MAX];
int main()
{
int n,k;
cin>>n>>k;
int i;
for(i=1;i<=n;++i)
{
char ch;
cin>>ch;
if(ch=='J')
vj[++vj[0]]=i;
if(ch=='O')
vo[++vo[0]]=i;
if(ch=='I')
vi[++vi[0]]=i;
}
int pj,po=1,pi=1;
int ans=1e9;
for(pj=1;pj<=vj[0]-k+1;++pj)
{
while(po+k-1<=vo[0] && vo[po]<vj[pj+k-1])
++po;
if(po+k-1<=vo[0])
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...