답안 #592896

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
592896 2022-07-09T18:59:48 Z NotLinux Kamenčići (COCI21_kamencici) C++14
0 / 70
1 ms 332 KB
/*  character : NotLinux
    stats : 
    - Skill : 2/10
    - Passion : 8/10
    - Rating : ~1400/3000 
    - Biggest Dream : being actually good at cp
    - Methods : Studying
    - Extras : No math or coding background
    - Started at : October of 2021  */
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#ifdef LOCAL
    #include "/home/notlinux/debug.h"
#else
    #define debug(x...) void(37)
    #define showarr(x) void(37)
#endif
void solve(){

}
int32_t main(){
    ios_base::sync_with_stdio(0);cin.tie(nullptr);
    //int tt;cin>>tt;while(tt--)solve();
    deque < char > q;
    int n,k;cin >> n >> k;
    string str;cin >> str;
    for(auto itr : str)q.push_back(itr);
    int cnt1 = 0;
    int cnt2 = 0;
    int turn = 0;
    debug(q);
    while(cnt1 != k and cnt2 != k and q.size())  {
        int last = q.size()-1;
        debug(q,turn);
        if(turn%2){//cnt2
            if(q[0] == 'P'){
                q.pop_front();
            }
            else if(q[last] == 'P'){
                q.pop_back();
            }
            else {
                cnt2++;
                debug(cnt2);
                q.pop_front()   ;
            }
        }
        else {//cnt1
            if(q[0] == 'P'){
                q.pop_front();
            }
            else if(q[last] == 'P'){
                q.pop_back();
            }
            else {
                cnt1++;
                debug(cnt1);
                q.pop_front()   ;
            }
        }
        turn++;
    }
    debug(q);
    debug(cnt1 , cnt2);
    if(cnt2 != k)cout << "NE" << endl;
    else cout << "DA" << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 324 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 324 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 324 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -