#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
string s;
cin>>s;
std::vector<int> v(n);
for(int i=0 ; i<n ; i++){
if(s[i]=='C'){
v[i] = 0;
}
else{
v[i] = 1;
}
}
int i = 0;
int j = n-1;
bool t = true;
while(i<=j){
if(t){
int x = max(v[i],v[j]);
if(x==0){
cout << "NE\n";
return 0;
}
if(v[i]==1){
i++;
}
else{
j--;
}
t = false;
}
else{
int x = max(v[i],v[j]);
if(x==0){
cout << "DA\n";
return 0;
}
if(v[i]==1){
i++;
}
else{
j--;
}
t = true;
}
}
}
/*int n,k;
cin>>n>>k;
vector<string>v(n);
for(int i=0;i<n;i++){
cin>>v[i];
}
bool a=true;
int i=0;
int j=n-1;
while(i<=j){
if(a=true){
if(v[i]=='c'&&v[j]=='c'){
cout<<"NE"<<endl;
return 0;
}
i++;
j--;
}
a=false;
else if(v[i]=='c'&&v[j]=='c'){
cout<<"DA"<<endl;
return 0;
}
i++;
j--;
a=true;
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |