QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#802910 | #9568. Left Shifting 3 | JJJ_ | WA | 1ms | 4424kb | C++14 | 1011b | 2024-12-07 15:10:55 | 2024-12-07 15:10:55 |
Judging History
answer
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<bits/stdc++.h>
using namespace std;
int f[200004];
int main(){
int t;
cin>>t;
while(t--){
int n,k,ans=0;
string s;
cin>>n>>k;
if(k>n) k=n;
cin>>s;
s=' '+s;
memset(f,0,sizeof(f));
//for(int i=1;i<=n;i++){
// cin>>s[i];
//s[i+n]=s[i];
//}
//cout<<s<<endl;
/*for(int i=1;i<=n+k;i++){
if(s[i]=='n' && s[i+1]=='a' && s[i+2]=='n' && s[i+3]=='j'
&& s[i+4]=='i' && s[i+5]=='n' && s[i+6]=='g'){
if(f[l]!=0 && i%f[l]==0) l++;
f[r++]=i;
cout<<l<<' '<<r<<' '<<i<<' '<<endl;
}
}
cout<<r-l+1<<endl;*/
for(int i=0;i+6<2*n;i++) {
if(s[i]=='n' && s[i+1]=='a' && s[i+2]=='n' && s[i+3]=='j' && s[i+4]=='i' && s[i+5]=='n' && s[i+6]=='g')
f[i]++;
f[i+1]+=f[i];
}
for(int i=0;i<=k;i++)
ans=max(ans,f[max(n+i-6,0)]-f[i]);
cout<<ans<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 4424kb
input:
4 21 10 jingicpcnanjingsuanan 21 0 jingicpcnanjingsuanan 21 3 nanjingnanjingnanjing 4 100 icpc
output:
1 1 3 0
result:
wrong answer 1st numbers differ - expected: '2', found: '1'