CSES - Datatähti 2022 loppu - Results
Submission details
Task:Peli
Sender:hltk
Submission time:2022-01-22 16:38:43 +0200
Language:C++ (C++17)
Status:READY
Result:11
Feedback
groupverdictscore
#1ACCEPTED11
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2, 3details
#20.01 s2, 3details
#30.01 s3details
#4ACCEPTED0.01 s1, 2, 3details
#5ACCEPTED0.01 s1, 2, 3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:16:10: warning: array subscript has type 'char' [-Wchar-subscripts]
       z[c] = 1;
          ^

Code

#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  if (k < 3) {
    cout << 0 << endl;
  } else {
    string s;
    cin >> s;
    bool z[128] {};
    int ans = 0;
    for (char c : s) {
      z[c] = 1;
      if (z['A'] && z['B'] && z['C']) {
        ans++;
        z['A'] = z['B'] = z['C'] = 0;
      }
    }
    cout << ans << endl;
  }
}

Test details

Test 1

Group: 1, 2, 3

Verdict: ACCEPTED

input
100000 3
BBAACBCBACBACABBCBAABCBCCBCCAA...

correct output
18201

user output
18201

Test 2

Group: 2, 3

Verdict:

input
100000 10
BAACABCCBCBAACBBCCCCABBBBACCBA...

correct output
29684

user output
18250

Test 3

Group: 3

Verdict:

input
100000 50
ACAABCBBAAAACCBBABACACACBCAACA...

correct output
32740

user output
18186

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