Submission #377373

# Submission time Handle Problem Language Result Execution time Memory
377373 2021-03-14T06:24:59 Z Vimmer Knjige (COCI20_knjige) C++14
0 / 50
306 ms 27944 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")

#define N 100500
#define NN 1005000
#define PB push_back
#define M ll(1e9 + 7)
#define all(x) x.begin(), x.end()
#define sz(x) int(x.size())
#define pri(x) cout << x << endl
#define endl '\n'
#define _ << " " <<
#define F first
#define S second

using namespace std;
//using namespace __gnu_pbds;

//typedef tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> oredered_set;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef short int si;

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

//    freopen("1.in", "r", stdin);

    int n;

    cin >> n;

    vector <int> a(n);

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

    int j = 0;

    vector <array <int, 3> > vr; vr.clear();

    while (1)
    {
        j = 0;

        while (j < n)
        {
            if (j + 1 != n && a[j + 1] < a[j])
            {
                int u = sz(a) - 1;

                vector <int> b; b.clear();

                while (u > j)
                {
                    b.PB(a.back());

                    vr.PB({0, 0, 0});

                    vr.PB({1, 0, 1});

                    a.pop_back();

                    u--;
                }

                int x = a.back();

                a.pop_back();

                vr.PB({0, 1, 0});

                while (sz(b))
                {
                    a.PB(b.back());

                    b.pop_back();

                    vr.PB({0, 0, 1});

                    vr.PB({1, 0, 0});
                }

                a.PB(x);

                vr.PB({1, 1, 0});

                break;
            }

            j++;
        }

        if (j == n)
            break;
    }

    string st[2] = {"UZMI", "STAVI"};
    string t[2] = {"L", "D"};

    pri(sz(vr));

    for (auto it : vr)
    {
        pri(st[it[0]] _ t[it[1]] _ t[it[2]]);
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 2788 KB Integer parameter [name=k] equals to 110542, violates the range [0, 100000]
2 Incorrect 131 ms 12896 KB Integer parameter [name=k] equals to 536982, violates the range [0, 100000]
3 Incorrect 164 ms 15428 KB Integer parameter [name=k] equals to 693424, violates the range [0, 100000]
4 Incorrect 249 ms 25176 KB Integer parameter [name=k] equals to 1057618, violates the range [0, 100000]
5 Incorrect 306 ms 27944 KB Integer parameter [name=k] equals to 1286650, violates the range [0, 100000]
6 Incorrect 225 ms 20932 KB Integer parameter [name=k] equals to 958566, violates the range [0, 100000]
7 Incorrect 6 ms 876 KB Wrong configuration
8 Incorrect 289 ms 26152 KB Integer parameter [name=k] equals to 1204984, violates the range [0, 100000]
9 Incorrect 282 ms 25512 KB Integer parameter [name=k] equals to 1173640, violates the range [0, 100000]
10 Incorrect 220 ms 20420 KB Integer parameter [name=k] equals to 934382, violates the range [0, 100000]