# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
499502 | Alisaf9 | Kamenčići (COCI21_kamencici) | C++14 | 193 ms | 524292 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;
int main()
{
string s;
int n,k,first=0,second=0,i=0;
bool w[n];
cin>>n>>k;
cin>>s;
int q=s.size()-1;
while (i<q)
{
if (s[i]=='P')
{
w[i]=1;
i++;
}
else if (s[q]=='P')
{
w[q]=1;
q--;
}
else if (s[i]=='C'&&s[i+1]=='C')
{
first++;
w[i]=1;
i++;
}
else if (s[q]=='C' && s[q-1]=='C')
{
first++;
w[q]=1;
q--;
}
else if (s[i]=='C')
{
first++;
w[i]=1;
i++;
}
if (first>=k)
break;
if (s[i]=='P')
{
w[i]=1;
i++;
}
else if (s[q]=='P')
{
w[q]=1;
q--;
}
else if (s[i]=='C' && s[i+1]=='C')
{
w[i]=1;
second++;
i++;
}
else if (s[q]=='C' && s[q-1]=='C')
{
w[q]=1;
second++;
q--;
}
else if (s[i]=='C')
{
w[i]=1;
second++;
i++;
}
if (second>=k)
break;
}
if (second>first)
{
cout<<"DA";
}
else
cout<<"NE";
return 0;
}
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... |