Submission #535505

# Submission time Handle Problem Language Result Execution time Memory
535505 2022-03-10T11:57:53 Z l3nl3 Kamenčići (COCI21_kamencici) C++14
0 / 70
1 ms 212 KB
/*#pragma GCC optimize("O3")
#pragma GCC target ("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")*/

#include <bits/stdc++.h>

#define int long long

using namespace std;

int n, k;
string s;

void go (int a, int b, int l, int r, int mv) {
	//cerr << a << ' ' << b << ' ' << l << ' ' << r << ' ' << mv << '\n';
	if (a == k || l >= r) return;
	if (b == k) cout << "DA", exit(false);
	if (mv) {
		if (s[l] == 'P') go(a, b, l+1, r, mv^1);
		else if (s[r] == 'P') go(a, b, l, r-1, mv^1);
		else if (s[l] == 'C') go(a+1, b, l+1, r, mv^1);
		else if (s[r] == 'C') go(a+1, b, l, r-1, mv^1);
	} else {
		if (s[l] == 'P') go(a, b, l+1, r, mv^1);
		else if (s[r] == 'P') go(a, b, l, r-1, mv^1);
		else if (s[l] == 'C') go(a, b+1, l+1, r, mv^1);
		else if (s[r] == 'C') go(a, b+1, l, r-1, mv^1);
	}
}

signed main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> n >> k >> s;
	go(0, 0, 0, n-1, 1);
	cout << "NE";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -