Submission #583820

# Submission time Handle Problem Language Result Execution time Memory
583820 2022-06-26T09:01:09 Z Hussein3602 Kamenčići (COCI21_kamencici) C++14
0 / 70
1 ms 212 KB
#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
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -