CSES - Datatähti 2022 loppu - Results
Submission details
Task:Peli
Sender:andreibe
Submission time:2022-01-22 14:41:16 +0200
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2, 3details
#20.01 s2, 3details
#30.01 s3details
#40.01 s1, 2, 3details
#50.01 s1, 2, 3details

Code

#include <iostream>
#include <string>
#include <math.h>
#include <map>
#include <algorithm>
#include <vector>
#include <fstream>
#include <set>
#include <unordered_map>
#include <queue>
#include <climits>
#include <stack>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define LOOP(i,a,l) for (int i = a; i < l; i++)
#define LUO_VERKKO LOOP(i,0,m) {int a,b; cin >> a >> b; v[a].push_back(b); v[b].push_back(a);}
#define COLLECT for (int i = 0; i < n; i++) cin >> s[i]
#define PRINT_LIST(l) for (int i = 0; i < l.size(); i++) cout << l[i] << " "
#define S second
#define F first
#define A 999999999999999999LL
#define M 1000000007
//https://cses.fi/dt/
int n;
int t;
#define N (1<<17)
int main() {
	cin >> n;
	int k; cin >> k;
	string s; cin >> s;
	bool a = false;
	bool b = false;
	bool c = false;
	int tulos = 0;
	for (int i = 0; i < n; i++)
	{
		char ch = s[i];
		if (ch == 'A') a = true;
		if (ch == 'B') b = true;
		if (ch == 'C') c = true;
		if (a && b && c) {
			tulos++;
			a = false; b = false; c = false;
		}
	}
	cout << tulos;
}

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:

input
3 1
ABC

correct output
0

user output
1

Test 5

Group: 1, 2, 3

Verdict:

input
3 2
ABC

correct output
0

user output
1