# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
377456 | VEGAnn | Knjige (COCI20_knjige) | C++14 | 4 ms | 1004 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define PB push_back
#define all(x) x.begin(),x.end()
#define i2 array<int,2>
#define i3 array<int,3>
using namespace std;
typedef long long ll;
const int oo = 2e9;
const int N = 110;
const int M = 10;
const int PW = 10;
const int HPW = 233;
const int md = int(1e9) + 7;
vector<int> who;
vector<i3> events;
int n, a[N];
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
/// 0 -- UZMI, 1 -- STAV
/// 0 -- L, 1 -- R
/// 0 -- L, 1 -- R
for (int it = n; it > 0; it--){
who.clear();
for (int i = 1; i <= it; i++)
if (a[i] == it)
events.PB({0, 0, 0});
else {
events.PB({0, 1, 0});
events.PB({1, 1, 1});
who.PB(a[i]);
}
events.PB({1, 0, 0});
a[it] = it;
reverse(all(who));
for (int jy = 0; jy < sz(who); jy++){
events.PB({0, 1, 1});
events.PB({1, 1, 0});
a[sz(who) - jy] = who[jy];
}
}
cout << sz(events) << '\n';
for (i3 cr : events){
if (cr[0])
cout << "STAVI ";
else cout << "UZMI ";
if (cr[1])
cout << "D ";
else cout << "L ";
if (cr[2])
cout << "D\n";
else cout << "L\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |