Task: | Peli |
Sender: | cowperso |
Submission time: | 2022-01-22 16:31:55 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 11 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 11 |
#2 | RUNTIME ERROR | 0 |
#3 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
#2 | RUNTIME ERROR | 0.01 s | 2, 3 | details |
#3 | RUNTIME ERROR | 0.01 s | 3 | details |
#4 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
#5 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
Code
#include <iostream> bool have[3]; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); uint32_t n, k; std::cin >> n >> k; std::string kirj; std::cin >> kirj; if (k < 3) { std::cout << "0\n"; return 0; } uint32_t res = 0; if (k == 3) { for (auto c : kirj) { if (have[c - 'A']) continue; have[c - 'A'] = true; if (have[0] && have[1] && have[2]) { ++res; have[0] = have[1] = have[2] = false; } } std::cout << res << '\n'; return 0; } else { return 1; } }
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: RUNTIME ERROR
input |
---|
100000 10 BAACABCCBCBAACBBCCCCABBBBACCBA... |
correct output |
---|
29684 |
user output |
---|
(empty) |
Test 3
Group: 3
Verdict: RUNTIME ERROR
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 |