Submission #797024

# Submission time Handle Problem Language Result Execution time Memory
797024 2023-07-29T04:51:49 Z tlnk07 Kamenčići (COCI21_kamencici) C++17
0 / 70
1 ms 304 KB
#include<bits/stdc++.h>
using namespace std;

long long n, m[2], l, r;
bool turn = 0;
string s;

int main()
{
	cin >> n >> m[0] >> s;
	m[1] = m[0];
	l = 0;	r = n - 1;
	while(l <= r && m[0] > 0 && m[1] > 0)
	{
		if(l == r)	
		{
			if(s[l] == 'C')	--m[turn];
			++l;
		}
		else if(s[l] == 'P')	++l;
		else if(s[r] == 'P')	--r;
		else if(s[l + 1] == 'P')
		{
			if(s[r] == 'C')	--m[turn];
			--r;
		}
		else if(s[r - 1] == 'P')
		{
			if(s[l] == 'C')	--m[turn];
			++l;
		}
		else
		{
			--m[turn];
			++l;
		}
		turn = 1 - turn;
	}
	if(m[0] == 0)	cout << "NE";
	else	cout << "DA";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 304 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 304 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 304 KB Output isn't correct
3 Halted 0 ms 0 KB -