# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
513942 |
2022-01-18T00:48:32 Z |
KoD |
Knjige (COCI20_knjige) |
C++17 |
|
3 ms |
656 KB |
#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 |
1 |
Correct |
2 ms |
656 KB |
Output is correct |
2 |
Correct |
2 ms |
656 KB |
Output is correct |
3 |
Correct |
2 ms |
656 KB |
Output is correct |
4 |
Correct |
2 ms |
656 KB |
Output is correct |
5 |
Correct |
2 ms |
656 KB |
Output is correct |
6 |
Correct |
3 ms |
656 KB |
Output is correct |
7 |
Correct |
1 ms |
460 KB |
Output is correct |
8 |
Correct |
3 ms |
656 KB |
Output is correct |
9 |
Correct |
2 ms |
656 KB |
Output is correct |
10 |
Correct |
2 ms |
656 KB |
Output is correct |