# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1188274 | SmuggingSpun | Knjige (COCI20_knjige) | C++20 | 1 ms | 968 KiB |
#include<bits/stdc++.h>
#define taskname "A"
using namespace std;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if(fopen(taskname".inp", "r")){
freopen(taskname".inp", "r", stdin);
}
int n;
cin >> n;
vector<int>a;
vector<string>ans;
for(int i = 0; i < n; i++){
int x, cnt = 0;
cin >> x;
ans.emplace_back("UZMI L L");
a.emplace_back(x);
for(int j = int(a.size()) - 1; j > 0 && a[j] < a[j - 1]; j--, cnt++){
swap(a[j], a[j - 1]);
ans.emplace_back("UZMI D D");
ans.emplace_back("STAVI D L");
}
ans.emplace_back("STAVI L D");
for(int _ = 0; _ < cnt; _++){
ans.emplace_back("UZMI D L");
ans.emplace_back("STAVI D D");
}
}
for(int i = 0; i < n; i++){
ans.emplace_back("UZMI D D");
ans.emplace_back("STAVI D L");
}
cout << ans.size() << "\n";
for(string& x : ans){
cout << x << "\n";
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |