QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#728295 | #9568. Left Shifting 3 | ucup-team4801# | RE | 0ms | 1584kb | C++17 | 1.0kb | 2024-11-09 14:55:20 | 2024-11-09 14:55:21 |
Judging History
answer
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#define fi first
#define se second
#define mkp std::make_pair
using ll=long long;
using llu=unsigned long long;
using std::max;
using std::min;
template<class T> void cmax(T&a,T b){a=max(a,b);}
template<class T> void cmin(T&a,T b){a=min(a,b);}
namespace xm{
char sz[200020];
void _(){
int N,K;
scanf("%d%d%s",&N,&K,sz+1);
int ans=0;
for(int i=0;i<=K;++i){
if(i) sz[N+i]=sz[i];
int cnt=0;
for(int j=1;j+6<=N;++j)
cnt+=(sz[i+j]=='n'
&&sz[i+j+1]=='a'
&&sz[i+j+2]=='n'
&&sz[i+j+3]=='j'
&&sz[i+j+4]=='i'
&&sz[i+j+5]=='n'
&&sz[i+j+6]=='g');
cmax(ans,cnt);
}
printf("%d\n",ans);
}
}
int main(){
int t;
scanf("%d",&t);
while(t--) xm::_();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 1584kb
input:
4 21 10 jingicpcnanjingsuanan 21 0 jingicpcnanjingsuanan 21 3 nanjingnanjingnanjing 4 100 icpc
output:
2 1 3 0
result:
ok 4 number(s): "2 1 3 0"
Test #2:
score: -100
Runtime Error
input:
2130 39 7 nnananjingannanjingngnanjinganjinggjina 1 479084228 g 33 2 gqnanjinggrjdtktnanjingcvsenanjin 24 196055605 ginganjingnanjingnanjing 23 3 ngnanjinganjingjinnanji 40 3 njingaaznannanjingnananjingyonwpnanjinga 40 207842908 nanjinggphconanjingkonanjinannanjinglxna 46 3 ingjingnnanjingnanjinging...