# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
370024 | penguinhacker | Knjige (COCI20_knjige) | C++14 | 5 ms | 1540 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// source: https://oj.uz/problem/view/COCI20_knjige
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
vector<int> v(n); for (int& i : v) cin >> i;
vector<string> ans;
for (int rep = 0; rep < n - 1; ++rep) {
int pos = max_element(v.begin(), v.end()) - v.begin();
vector<int> nv(v.begin(), v.begin() + pos);
vector<int> t(v.begin() + pos + 1, v.end());
nv.insert(nv.end(), t.begin(), t.end());
for (int i = 0; i < pos; ++i) ans.push_back("UZMI L L"), ans.push_back("STAVI L D");
ans.push_back("UZMI D L");
for (int i = pos + 1; i < n - rep; ++i) ans.push_back("UZMI L L"), ans.push_back("STAVI L D");
ans.push_back("STAVI D L");
for (int i = 1; i < n - rep; ++i) ans.push_back("UZMI L D"), ans.push_back("STAVI L L");
swap(v, nv);
}
cout << ans.size() << "\n";
for (string s : ans) cout << s << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |