Submission #542012

# Submission time Handle Problem Language Result Execution time Memory
542012 2022-03-25T06:55:16 Z AlperenT Knjige (COCI20_knjige) C++17
0 / 50
2 ms 984 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 100 + 5;

int t, n, arr[N], a = -1, b = -1;

stack<int> lft, rght;

vector<string> ans;

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);

    cin >> n;

    for(int i = 1; i <= n; i++) cin >> arr[i];

    for(int i = n; i >= 1; i--) lft.push(arr[i]);

    while(!lft.empty()){
        ans.push_back("UZMI L L");

        a = lft.top(); lft.pop();

        while(!rght.empty() && rght.top() > a){
            ans.push_back("UZMI R R");

            b = rght.top(); rght.pop();

            ans.push_back("STAVI R L");

            lft.push(b); b = -1;
        }

        ans.push_back("STAVI L R");

        rght.push(a); a = -1;
    }

    while(!rght.empty()){
        ans.push_back("UZMI L R");

        a = rght.top(); rght.pop();

        ans.push_back("STAVI L L");

        lft.push(a);
    }

    cout << ans.size() << "\n";

    for(auto str : ans) cout << str << "\n";
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 984 KB Token "R" doesn't correspond to pattern "(L|D)"
2 Incorrect 1 ms 976 KB Token "R" doesn't correspond to pattern "(L|D)"
3 Incorrect 1 ms 984 KB Token "R" doesn't correspond to pattern "(L|D)"
4 Incorrect 1 ms 968 KB Token "R" doesn't correspond to pattern "(L|D)"
5 Incorrect 2 ms 984 KB Token "R" doesn't correspond to pattern "(L|D)"
6 Incorrect 2 ms 984 KB Token "R" doesn't correspond to pattern "(L|D)"
7 Incorrect 1 ms 728 KB Token "R" doesn't correspond to pattern "(L|D)"
8 Incorrect 2 ms 984 KB Token "R" doesn't correspond to pattern "(L|D)"
9 Incorrect 2 ms 968 KB Token "R" doesn't correspond to pattern "(L|D)"
10 Incorrect 2 ms 984 KB Token "R" doesn't correspond to pattern "(L|D)"