Submission #662957

# Submission time Handle Problem Language Result Execution time Memory
662957 2022-11-26T13:50:47 Z Manoush Kamenčići (COCI21_kamencici) C++14
0 / 70
1 ms 220 KB
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
#define pb push_back

using namespace std;

int main()
{
    ll n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    ll first=0;
    ll second=0;
    ll r=n-1;
    ll l=0;
    while (first!=k&&second!=k)
    {
        if (s[l]=='P')
        {
            l++;
        }else if (s[r]=='P')
        {
            r--;
        }
        else
        {
            l++;
            first++;
        }
        if (first==k)break;
        if (s[l]=='P')
        {
            l++;
        }else if (s[r]=='P')
        {
            r--;
        }
        else
        {
            l++;
            second++;
        }
    }
    if (first==k)
        cout<<"NE"<<endl;
    else
        cout<<"DA"<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 220 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 220 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 220 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -