#include<bits/stdc++.h>
using namespace std;
int main (){
int n;
bool answ = true;
int antun = 0;
int counter=0;
int turn = 0;
int branka = 0;
int k;
cin>>n>>k;
k = k*2-1;
string pebbles;
cin>>pebbles;
while (antun<k&&branka<k){
if(pebbles[counter]==80){
turn++;
counter++;
}
else if(pebbles[n-counter-1]==80){
turn++;
counter++;
}
else {
if(turn%2==1){
branka++;
}
else{
antun++;
}
turn++;
}
}
if(antun>branka){
answ = false;
}
if (answ==true){
cout<<"DA";
}
else{
cout<<"NE";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |