Submission #499442

#TimeUsernameProblemLanguageResultExecution timeMemory
499442RandeKamenčići (COCI21_kamencici)C++14
0 / 70
0 ms204 KiB
#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; } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...