# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
513942 | KoD | Knjige (COCI20_knjige) | C++17 | 3 ms | 656 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using std::vector;
using std::array;
using std::pair;
using std::tuple;
#define TAKE 0
#define PUT 1
#define LEFT 0
#define RIGHT 1
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int N;
std::cin >> N;
vector<int> D(N);
for (auto& x : D) {
std::cin >> x;
}
vector<tuple<int, int, int>> ans;
while (!D.empty()) {
auto itr = std::min_element(D.begin(), D.end());
const int idx = itr - D.begin();
for (int i = 0; i < idx; ++i) {
ans.emplace_back(TAKE, LEFT, LEFT);
ans.emplace_back(PUT, LEFT, RIGHT);
}
ans.emplace_back(TAKE, RIGHT, LEFT);
for (int i = 0; i < idx; ++i) {
ans.emplace_back(TAKE, LEFT, RIGHT);
ans.emplace_back(PUT, LEFT, LEFT);
}
ans.emplace_back(PUT, RIGHT, RIGHT);
D.erase(itr);
}
for (int i = 0; i < N; ++i) {
ans.emplace_back(TAKE, LEFT, RIGHT);
ans.emplace_back(PUT, LEFT, LEFT);
}
std::cout << ans.size() << '\n';
for (const auto& [i, h, s] : ans) {
std::cout << (i ? "STAVI" : "UZMI") << ' ' << "LD"[h] << ' ' << "LD"[s] << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |