# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1104187 | melody_rules | Knjige (COCI20_knjige) | C++17 | 20 ms | 972 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int n=0;
int m=0;
int a=0;
int b=0;
int i=0;
int j=0;
string s;
cin>>n;
vector<int> vec(n);
vector<int> vecoo(n);
vector<string> fin;
for(i=0;i<n;i++) {
cin>>a;
vec.at(i) = a;
vecoo.at(i) = a;
}
sort(vecoo.begin(), vecoo.end());
while(j < (n-1)) {
m = vec.size();
for(i=0;i<m;i++) {
if(vec.at(i) == vecoo.at(j))
break;
s = "UZMI L L";
fin.push_back(s);
s = "STAVI L D";
fin.push_back(s);
}
s = "UZMI D L";
fin.push_back(s);
vec.erase(vec.begin() + i);
a=i;
for(;i>0;i--) {
s = "UZMI L D";
fin.push_back(s);
s = "STAVI L L";
fin.push_back(s);
}
s = "STAVI D D";
fin.push_back(s);
j++;
}
cout<<fin.size() + 2*n - 2<<endl;
for(auto x : fin)
cout<<x<<endl;
for(i=0;i<(n-1);i++) {
cout<<"UZMI L D"<<endl;
cout<<"STAVI L L"<<endl;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |