Task: | Peli |
Sender: | xenial |
Submission time: | 2022-01-22 16:21:18 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#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 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#5 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
Compiler report
input/code.cpp: In function 'void set_io(std::__cxx11::string)': input/code.cpp:19:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen((filename + ".in").c_str(), "r", stdin); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input/code.cpp:20:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen((filename + ".out").c_str(), "w", stdout); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) (x).begin(), (x).end() #define pb push_back #define fi first #define se second #define sz size #define rsz resize #define ii pair<int,int> #define vi vector<int> #define vvi vector<vector<int>> void set_io(string filename = "") { ios::sync_with_stdio(0); cin.tie(0); if (filename != "") { freopen((filename + ".in").c_str(), "r", stdin); freopen((filename + ".out").c_str(), "w", stdout); } } int N, K; set<char> bag; int main() { set_io(""); cin >> N >> K; string s; cin >> s; ll ans = 0; for (auto c : s) { if (bag.count(c) == 0) bag.insert(c); if (bag.sz() == 3) { bag = set<char>(); ans++; } } 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: WRONG ANSWER
input |
---|
100000 10 BAACABCCBCBAACBBCCCCABBBBACCBA... |
correct output |
---|
29684 |
user output |
---|
18250 |
Test 3
Group: 3
Verdict: WRONG ANSWER
input |
---|
100000 50 ACAABCBBAAAACCBBABACACACBCAACA... |
correct output |
---|
32740 |
user output |
---|
18186 |
Test 4
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
3 1 ABC |
correct output |
---|
0 |
user output |
---|
1 |
Test 5
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
3 2 ABC |
correct output |
---|
0 |
user output |
---|
1 |