#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
#define pb push_back
using namespace std;
int main()
{
ll n,k;
cin>>n>>k;
string s;
cin>>s;
ll first=0;
ll second=0;
ll r=n-1;
ll l=0;
while (first!=k&&second!=k)
{
if (s[l]=='P')
{
l++;
}else if (s[r]=='P')
{
r--;
}
else
{
if (s[l+1]=='C')
{
l++;
}
else
{
r--;
}
first++;
}
if (first==k)break;
if (s[l]=='P')
{
l++;
}else if (s[r]=='P')
{
r--;
}
else
{
if (s[l+1]=='C')
{
l++;
}
else
{
r--;
}
second++;
}
}
if (first==k)
cout<<"NE"<<endl;
else
cout<<"DA"<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |