QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#734678#9568. Left Shifting 3wifi32767WA 7ms3708kbC++20798b2024-11-11 14:04:232024-11-11 14:04:23

Judging History

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

  • [2024-11-11 14:04:23]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3708kb
  • [2024-11-11 14:04:23]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
using ll = long long;
const int MAX = 3e5 + 5;

void solve(){
    int n, k; cin >> n >> k;
    string s; cin >> s;
    int ans = 0;
    string t = "nanjing";
    for (int i = 0; i < min(7, k + 1); i ++){
        int cur = 0, res = 0;
        for (int j = 0; j < n; j ++){
            if (s[(i + j) % n] == t[cur]){
                cur ++;
                if (cur == 7){
                    res ++;
                    cur = 0;
                }
            }
            else cur = 0;
        }
        ans = max(ans, res);
    }
    cout << ans << endl;
}
signed main(){
    ios::sync_with_stdio(0);cin.tie(0);
    // cout << fixed << setprecision(10);
    int T;cin>>T;while (T--)
        solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3708kb

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
Wrong Answer
time: 7ms
memory: 3592kb

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:

2
0
3
2
1
1
2
1
2
4
0
1
3
3
1
1
1
1
3
2
0
2
2
0
0
1
0
0
0
4
4
0
1
2
1
0
2
1
1
0
2
2
1
1
1
0
0
1
4
0
2
1
1
0
2
3
0
1
0
0
1
1
2
2
1
0
0
3
0
0
0
1
0
2
0
1
1
0
0
0
0
0
1
1
0
4
4
3
1
1
1
1
1
0
0
5
1
0
0
1
0
0
2
3
1
2
3
1
0
2
1
1
2
0
1
0
0
0
0
3
0
2
0
3
1
0
1
1
2
1
1
1
0
0
0
0
1
4
1
3
1
0
1
1
2
1
2
1
0
3
...

result:

wrong answer 1st numbers differ - expected: '3', found: '2'