# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
872527 | Onur_Ilgaz | Knjige (COCI20_knjige) | C++17 | 2 ms | 1564 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fast cin.tie(0)->sync_with_stdio(0);
#define int long long
#define inf ((int)1e18)
using namespace std;
int32_t main(){
fast
int n;
cin >> n;
vector <int> arr(n), order;
for(int i = 0; i < n; i++) {
cin >> arr[i];
order.push_back(arr[i]);
}
sort(order.begin(), order.end());
vector<string> output;
for(int i = 0; i < n; i++) {
// i şimdiye kadar silinen eleman sayısı aynı zamanda
int eleman = order[i];
int from;
for(int j = 0; j < arr.size(); j++) {
if(arr[j] == eleman) {
from = j;
break;
}
}
if(!from) {
arr.erase(arr.begin() + from);
continue;
}
// to = i
for(int i = 0; i < arr.size(); i++) {
if(i == from) {
output.push_back("UZMI D L\n");
}
else {
output.push_back("UZMI L L\n");
output.push_back("STAVI L D\n");
}
}
output.push_back("STAVI D L\n");
for(int i = 0; i < arr.size() - 1; i++) {
output.push_back("UZMI L D\n");
output.push_back("STAVI L L\n");
}
arr.erase(arr.begin() + from);
}
cout << output.size() << "\n";
for(auto &it:output) {
cout << it;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |