This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
}
cout << "DA" << endl;
}
/*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;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |