QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#728295#9568. Left Shifting 3ucup-team4801#RE 0ms1584kbC++171.0kb2024-11-09 14:55:202024-11-09 14:55:21

Judging History

你现在查看的是最新测评结果

  • [2024-11-09 14:55:21]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:1584kb
  • [2024-11-09 14:55:20]
  • 提交

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;
}

详细

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...

output:


result: