#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define sz(a) (int)a.size()
#define ll long long
#define ld long double
signed main()
{
//ifstream cin("286.txt");
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector <int> d(n);
for(int i = 0; i < n; i++)
{
cin >> d[i];
}
vector <string> ans;
vector <int> mass;
for(int i = 0; i < n; i++)
{
ans.push_back("UZMI L L");
int cnt = 0;
vector <int> t;
while(sz(mass) > 0 && mass.back() > d[i])
{
cnt++;
ans.push_back("UZMI D D");
t.push_back(mass.back());
ans.push_back("STAVI D L");
mass.pop_back();
}
ans.push_back("STAVI L D");
while(cnt--)
{
mass.push_back(t.back());
t.pop_back();
ans.push_back("UZMI D L");
ans.push_back("STAVI D D");
}
mass.push_back(d[i]);
}
while(n--)
{
ans.push_back("UZMI D D");
ans.push_back("STAVI D L");
}
cout << sz(ans) << "\n";
for(auto s : ans)
cout << s << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Wrong configuration |
2 |
Incorrect |
1 ms |
460 KB |
Wrong configuration |
3 |
Incorrect |
1 ms |
332 KB |
Wrong configuration |
4 |
Incorrect |
1 ms |
332 KB |
Wrong configuration |
5 |
Incorrect |
1 ms |
464 KB |
Wrong configuration |
6 |
Incorrect |
1 ms |
460 KB |
Wrong configuration |
7 |
Incorrect |
1 ms |
332 KB |
Wrong configuration |
8 |
Incorrect |
1 ms |
332 KB |
Wrong configuration |
9 |
Incorrect |
1 ms |
332 KB |
Wrong configuration |
10 |
Incorrect |
1 ms |
332 KB |
Wrong configuration |