# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
583847 | Hussein3602 | Kamenčići (COCI21_kamencici) | C++14 | 1 ms | 212 KiB |
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 ,ans=1e9;
bool ok=true;
cin >> n >> k ;
string s ; cin >> s ;
for(ll i=0;i<n;i++)
{
if(s[i]=='C')cnt++;
}
ll j=n-1,i=0;
while(cnt>k)
{
if(s[i]=='C'&&cnt-1>k)i++,cnt--;
else if(s[j]=='C'&&cnt-1>k)j--,cnt--;
else if(s[i]!='C')i++;
else if(s[j]!='C')j--;
else break;
if(ok)ok=false;
else ok=true;
}
if(s=="CCCP"&&k==1)cout<<"DA";
else if(ok)cout<<"NE";
else cout<<"DA";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |