#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int a[n], d[n];
for (int i = 0; i < n; i ++)
cin >> d[i], a[i] = d[i];
sort(a, a + n);
int cur = n - 1;
int done = 0;
vector<pair<string, pair<char, char>>> vec;
while (cur >= 0){
int placed = 0;
vector<int> tmp;
for (int i = 0; i < n - done; i ++){
if (d[i] == a[cur]){
vec.push_back({"UZMI", {'L', 'L'}});
}
else{
vec.push_back({"UZMI", {'R', 'L'}});
vec.push_back({"STAVI", {'R', 'R'}});
tmp.push_back(d[i]);
placed++;
}
}
vec.push_back({"STAVI", {'L', 'L'}});
while (placed){
placed--;
vec.push_back({"UZMI", {'R', 'R'}});
vec.push_back({"STAVI", {'R', 'L'}});
}
d[cur] = a[cur];
for (int i = 0; i < cur; i ++)
d[i] = tmp[i];
cur--;
}
cout << vec.size() << endl;
for (auto [s, P] : vec){
auto [x, y] = P;
cout << s << " " << x << " " << y << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
43 ms |
3024 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
2 |
Incorrect |
46 ms |
3028 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
3 |
Incorrect |
38 ms |
3028 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
4 |
Incorrect |
45 ms |
4052 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
5 |
Incorrect |
43 ms |
4304 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
6 |
Incorrect |
42 ms |
3796 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
7 |
Incorrect |
39 ms |
2004 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
8 |
Incorrect |
58 ms |
3028 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
9 |
Incorrect |
41 ms |
3024 KB |
Token "R" doesn't correspond to pattern "(L|D)" |
10 |
Incorrect |
43 ms |
3028 KB |
Token "R" doesn't correspond to pattern "(L|D)" |