Task: | Peli |
Sender: | Totska |
Submission time: | 2022-01-22 15:19:38 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 11 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 11 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
#2 | WRONG ANSWER | 0.01 s | 2, 3 | details |
#3 | WRONG ANSWER | 0.01 s | 3 | details |
#4 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
#5 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:27:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if(bag.size() == k){ ~~~~~~~~~~~^~~~
Code
#include <bits/stdc++.h> #define ll long long using namespace std; #define fr(x) for(ll i = 0; i < x; i++) int main() { ios_base::sync_with_stdio(false); cin.tie(0); ll n, k, ans; string s; unordered_set<char> bag; cin >> n >> k; cin >> s; if(k > 2){ ans = 0; for (auto it = s.begin(); it != s.end(); it++) { bag.insert(*it); if(bag.size() == k){ ++ans; bag.clear(); } } cout << ans << endl; } else{ cout << 0 << 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: WRONG ANSWER
input |
---|
100000 10 BAACABCCBCBAACBBCCCCABBBBACCBA... |
correct output |
---|
29684 |
user output |
---|
0 |
Test 3
Group: 3
Verdict: WRONG ANSWER
input |
---|
100000 50 ACAABCBBAAAACCBBABACACACBCAACA... |
correct output |
---|
32740 |
user output |
---|
0 |
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 |