Submission #662996

#TimeUsernameProblemLanguageResultExecution timeMemory
662996ManoushKamenčići (COCI21_kamencici)C++14
10 / 70
1 ms212 KiB
#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 if (s[r-1]=='C') { r--; } else if (s[l+2]=='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]=='P') { l++; } else if (s[r-1]=='P') { r--; } else if (s[l+2]=='P') { l++; } else { r--; } second++; } } if (first==k) cout<<"NE"<<endl; else cout<<"DA"<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...