Submission #377456

# Submission time Handle Problem Language Result Execution time Memory
377456 2021-03-14T08:41:05 Z VEGAnn Knjige (COCI20_knjige) C++14
0 / 50
4 ms 1004 KB
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define PB push_back
#define all(x) x.begin(),x.end()
#define i2 array<int,2>
#define i3 array<int,3>
using namespace std;
typedef long long ll;
const int oo = 2e9;
const int N = 110;
const int M = 10;
const int PW = 10;
const int HPW = 233;
const int md = int(1e9) + 7;
vector<int> who;
vector<i3> events;
int n, a[N];

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

#ifdef _LOCAL
    freopen("in.txt","r",stdin);
#endif // _LOCAL

    cin >> n;

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

    /// 0 -- UZMI, 1 -- STAV
    /// 0 -- L, 1 -- R
    /// 0 -- L, 1 -- R

    for (int it = n; it > 0; it--){
        who.clear();

        for (int i = 1; i <= it; i++)
            if (a[i] == it)
                events.PB({0, 0, 0});
            else {
                events.PB({0, 1, 0});
                events.PB({1, 1, 1});
                who.PB(a[i]);
            }

        events.PB({1, 0, 0});
        a[it] = it;

        reverse(all(who));

        for (int jy = 0; jy < sz(who); jy++){
            events.PB({0, 1, 1});
            events.PB({1, 1, 0});

            a[sz(who) - jy] = who[jy];
        }
    }

    cout << sz(events) << '\n';

    for (i3 cr : events){
        if (cr[0])
            cout << "STAVI ";
        else cout << "UZMI ";

        if (cr[1])
            cout << "D ";
        else cout << "L ";

        if (cr[2])
            cout << "D\n";
        else cout << "L\n";
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 876 KB Cannot put a book with empty hand
2 Incorrect 3 ms 876 KB Cannot put a book with empty hand
3 Incorrect 3 ms 876 KB Cannot hold multiple books at one hand
4 Incorrect 3 ms 876 KB Cannot put a book with empty hand
5 Incorrect 4 ms 1004 KB Cannot put a book with empty hand
6 Incorrect 3 ms 876 KB Cannot put a book with empty hand
7 Incorrect 4 ms 876 KB Cannot put a book with empty hand
8 Incorrect 4 ms 876 KB Cannot put a book with empty hand
9 Incorrect 4 ms 876 KB Cannot put a book with empty hand
10 Incorrect 3 ms 876 KB Cannot put a book with empty hand