# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1006558 |
2024-06-24T03:15:40 Z |
vjudge1 |
Knjige (COCI20_knjige) |
C++17 |
|
28 ms |
3268 KB |
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
int main()
{
int n,x;
cin>>n;
vector<int> a,alias;
for (int i=0;i<n;i++)
{
cin>>x;
a.push_back(x);
}
vector<vector<string>> ans;
alias=a;
sort(all(alias),greater<int>());
reverse(all(a));
for (int i=0;i<n;i++)
{
bool b=1;
for (int j=n-1;j>=i;j--)
{
if (a[j]==alias[i] && b)
{
ans.push_back({"UZMI","D","L"});
b=0;
}
else
{
ans.push_back({"UZMI","L","L"});
ans.push_back({"STAVI","L","D"});
}
}
ans.push_back({"STAVI","D","L"});
b=0;
for (int j=n-1;j>i;j--)
{
if (alias[i]==a[j])
b=1;
ans.push_back({"UZMI","L","D"});
ans.push_back({"STAVI","L","L"});
if (b)
swap(a[j],a[j-1]);
}
}
cout<<ans.size()<<endl;
for (auto i:ans)
cout<<i[0]<<' '<<i[1]<<' '<<i[2]<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
3196 KB |
Output is correct |
2 |
Correct |
24 ms |
3092 KB |
Output is correct |
3 |
Correct |
25 ms |
3088 KB |
Output is correct |
4 |
Correct |
24 ms |
3092 KB |
Output is correct |
5 |
Correct |
26 ms |
3088 KB |
Output is correct |
6 |
Correct |
24 ms |
3268 KB |
Output is correct |
7 |
Correct |
24 ms |
3092 KB |
Output is correct |
8 |
Correct |
24 ms |
3188 KB |
Output is correct |
9 |
Correct |
23 ms |
3088 KB |
Output is correct |
10 |
Correct |
24 ms |
3092 KB |
Output is correct |