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 ;
typedef long long ll ;
int main(){
ll n , k , cnt=0 , j=0 ,ans=1e9;
cin >> n >> k ;
string s ; cin >> s ;
for(ll i=0 ; i<n ;i++)
{
if(s[i]=='C')cnt++;
while(cnt>k&&j<n)
{
if(cnt==k+1)ans=min(ans,i-j+1);
if(s[j]=='C')cnt--;
j++;
}
if(cnt==k&&cnt==i-j+1){
//cout<<i-j+1<<endl;
ans=min(ans,i-j+1);
}
}
//cout<<ans<<endl;
string res=((n-ans)%2)?"NE":"DA";
cout<<res<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |