답안 #662958

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
662958 2022-11-26T13:50:47 Z Manoush Kamenčići (COCI21_kamencici) C++14
0 / 70
1 ms 300 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -