// 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 R");
ans.push_back("UZMI R L");
for (int i = pos + 1; i < n - rep; ++i) ans.push_back("UZMI L L"), ans.push_back("STAVI L R");
ans.push_back("STAVI R L");
for (int i = 1; i < n - rep; ++i) ans.push_back("UZMI L R"), ans.push_back("STAVI L L");
swap(v, nv);
}
cout << ans.size() << "\n";
for (string s : ans) cout << s << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
1520 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
2 |
Incorrect |
5 ms |
1520 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
3 |
Incorrect |
4 ms |
1520 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
4 |
Incorrect |
4 ms |
1520 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
5 |
Incorrect |
4 ms |
1524 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
6 |
Incorrect |
4 ms |
1520 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
7 |
Incorrect |
4 ms |
1516 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
8 |
Incorrect |
4 ms |
1520 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
9 |
Incorrect |
5 ms |
1520 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
10 |
Incorrect |
4 ms |
1572 KB |
Token "R" doesn't correspond to pattern "(L|D)" |