답안 #405666

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
405666 2021-05-16T16:40:41 Z souvenir_vayne Knjige (COCI20_knjige) C++14
0 / 50
33 ms 588 KB
#include<bits/stdc++.h>

using namespace std;

int32_t main() {

    int n;
    cin >> n;

    long long ans = 0;
    for(int i = 0; i < n; i++)
        ans += 2 * (n - i) + 2*(n - i - 1);
    cout << ans << endl;

    stack<int> left, right;

    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        left.push(x);
    }


    int did = 0;


    while(did < n) {

        stack<int> aux;

        int mn = INT_MAX;
        while(!left.empty()) {

            mn = min(mn, left.top());

            aux.push(left.top());
            left.pop();

        }

        left = aux;
        bool taken = false;
        for(int i = 0; i < n - did; i++) {
            if(left.top() == mn && !taken) {
                taken = true;
                cout << "UZMI L L" << endl;
            }
            else {
                cout << "UZMI R L" << endl << "STAVI R R" << endl;
                right.push(left.top());
            }
            left.pop();
        }

        did++;
        cout << "STAVI L L" << endl;


        while(!right.empty()) {
            cout << "UZMI R R" << endl << "STAVI R L" << endl;
            left.push(right.top());
            right.pop();
        }

    }

}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 412 KB Token "R" doesn't correspond to pattern "(L|D)"
2 Incorrect 32 ms 460 KB Token "R" doesn't correspond to pattern "(L|D)"
3 Incorrect 33 ms 372 KB Token "R" doesn't correspond to pattern "(L|D)"
4 Incorrect 32 ms 452 KB Token "R" doesn't correspond to pattern "(L|D)"
5 Incorrect 32 ms 460 KB Token "R" doesn't correspond to pattern "(L|D)"
6 Incorrect 31 ms 520 KB Token "R" doesn't correspond to pattern "(L|D)"
7 Incorrect 33 ms 588 KB Token "R" doesn't correspond to pattern "(L|D)"
8 Incorrect 33 ms 452 KB Token "R" doesn't correspond to pattern "(L|D)"
9 Incorrect 32 ms 368 KB Token "R" doesn't correspond to pattern "(L|D)"
10 Incorrect 32 ms 424 KB Token "R" doesn't correspond to pattern "(L|D)"