Submission #405670

# Submission time Handle Problem Language Result Execution time Memory
405670 2021-05-16T16:53:14 Z souvenir_vayne Knjige (COCI20_knjige) C++14
0 / 50
32 ms 584 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);
    }

    stack<int> aux;
    while(!left.empty()) {
        aux.push(left.top());
        left.pop();
    }

    left = aux;

    int did = 0;
    while(did < n) {

        int mn = INT_MAX;

        aux = left;
        while(!aux.empty()) {
            mn = min(mn, aux.top());
            aux.pop();
        }

        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 D L" << endl << "STAVI D D" << endl;
                right.push(left.top());
            }
            left.pop();
        }

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


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

    }

}
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 468 KB Wrong configuration
2 Incorrect 32 ms 396 KB Wrong configuration
3 Incorrect 32 ms 380 KB Wrong configuration
4 Incorrect 32 ms 368 KB Wrong configuration
5 Incorrect 31 ms 452 KB Wrong configuration
6 Incorrect 32 ms 460 KB Wrong configuration
7 Incorrect 32 ms 584 KB Wrong configuration
8 Incorrect 32 ms 460 KB Wrong configuration
9 Incorrect 32 ms 440 KB Wrong configuration
10 Incorrect 31 ms 460 KB Wrong configuration