답안 #662984

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
662984 2022-11-26T14:02:12 Z Manoush Kamenčići (COCI21_kamencici) C++14
10 / 70
1 ms 304 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
        {
            if (s[l+1]=='C')
            {
                l++;
            }
            else
            {
                r--;
            }
            first++;
        }
        if (first==k)break;
        if (s[l]=='P')
        {
            l++;
        }else if (s[r]=='P')
        {
            r--;
        }
        else
        {
            if (s[l+1]=='P')
            {
                l++;
            }
            else
            {
                r--;
            }
            second++;
        }
    }
    if (first==k)
        cout<<"NE"<<endl;
    else
        cout<<"DA"<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 224 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 1 ms 300 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Incorrect 1 ms 304 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 224 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 1 ms 300 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Incorrect 1 ms 304 KB Output isn't correct
12 Halted 0 ms 0 KB -