CSES - Datatähti 2022 loppu - Results
Submission details
Task:Peli
Sender:Mahtimursu
Submission time:2022-01-22 14:50:33 +0200
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.01 s1, 2, 3details
#20.01 s2, 3details
#30.01 s3details
#4ACCEPTED0.01 s1, 2, 3details
#5ACCEPTED0.01 s1, 2, 3details

Code

#include <bits/stdc++.h>

typedef long long ll;

#define M 1000000007
#define N (1 << 18)

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    string v;
    cin >> v;
    if (k < 3) {
        cout << 0 << "\n";
        return 0;
    }
    int ans = 0;
    for (int i = 2; i < n; ++i) {
        set<char> st;

        for (int j = i; j >= i - 2; --j) {
            st.insert(v[j]);
        }

        if (st.size() == 3) {
            ans++;
            i += 2;
        }
    }

    return 0;
}

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
100000 3
BBAACBCBACBACABBCBAABCBCCBCCAA...

correct output
18201

user output
(empty)

Test 2

Group: 2, 3

Verdict:

input
100000 10
BAACABCCBCBAACBBCCCCABBBBACCBA...

correct output
29684

user output
(empty)

Test 3

Group: 3

Verdict:

input
100000 50
ACAABCBBAAAACCBBABACACACBCAACA...

correct output
32740

user output
(empty)

Test 4

Group: 1, 2, 3

Verdict: ACCEPTED

input
3 1
ABC

correct output
0

user output
0

Test 5

Group: 1, 2, 3

Verdict: ACCEPTED

input
3 2
ABC

correct output
0

user output
0