제출 #844064

#제출 시각아이디문제언어결과실행 시간메모리
844064RealPandaKamenčići (COCI21_kamencici)C++17
70 / 70
1 ms600 KiB
#include <bits/stdc++.h> using namespace std; int n, k; int main () { cin >> n >> k; int c[2]; c[0] = c[1] = k; string s; cin >> s; int l = 0, r = n-1; int turn = 0; while(l <= r && c[0] > 0 && c[1] > 0) { if(s[l] == 'P') { l++; } else if(s[r] == 'P') { r--; } else { c[turn]--; int t1, t2; t1 = t2 = 0; while(s[l + t1] != 'P' && (l+t1) < n-1) { t1++; } while(s[r-t2]!= 'P' && (r-t2) > 0) { t2++; } if(t1 >= t2) { l++; } else { r--; } } turn ^=1; } if(c[0] > 0) { cout << "DA" << endl; } else { cout << "NE" << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...