제출 #499505

#제출 시각아이디문제언어결과실행 시간메모리
499505Alisaf9Kamenčići (COCI21_kamencici)C++14
70 / 70
1 ms292 KiB
#include <bits/stdc++.h> using namespace std; int main() { string s; int n,k,first=0,second=0,i=0; cin>>n>>k; cin>>s; int q=s.size()-1; while (i<q) { if (s[i]=='P') { i++; } else if (s[q]=='P') { q--; } else if (s[i]=='C'&&s[i+1]=='C') { first++; i++; } else if (s[q]=='C' && s[q-1]=='C') { first++; q--; } else if (s[i]=='C') { first++; i++; } if (first>=k) break; if (s[i]=='P') { i++; } else if (s[q]=='P') { q--; } else if (s[i]=='C' && s[i+1]=='C') { second++; i++; } else if (s[q]=='C' && s[q-1]=='C') { second++; q--; } else if (s[i]=='C') { second++; i++; } if (second>=k) break; } if (second>first) { cout<<"DA"; } else cout<<"NE"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...