Submission #583820

#TimeUsernameProblemLanguageResultExecution timeMemory
583820Hussein3602Kamenčići (COCI21_kamencici)C++14
0 / 70
1 ms212 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...