| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1006558 | vjudge1 | Knjige (COCI20_knjige) | C++17 | 28 ms | 3268 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
|---|---|---|---|---|
| Fetching results... | ||||
