# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
838511 | skittles1412 | Art Collections (BOI22_art) | C++17 | 1410 ms | 588 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/extc++.h"
using namespace std;
template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
cerr << t;
((cerr << " | " << u), ...);
cerr << endl;
}
#ifdef DEBUG
#define dbg(...) \
cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \
dbgh(__VA_ARGS__)
#else
#define dbg(...)
#define cerr \
if (false) \
cerr
#endif
#define endl "\n"
#define long int64_t
#define sz(x) int(std::size(x))
/**
* returns how many complaints you will receive for this ordering of the art collections
*/
int publish(vector<int>);
/**
* use this function when you have found the correct order of the art collections
* You must call answer exactly once; your program will be automatically
* terminated afterwards.
*/
void answer(vector<int>);
/**
* implement this function
*/
void solve(int n) {
int arr[n];
vector<int> perm(n);
for (int i = 0; i < n; i++) {
perm[i] = n - i;
}
for (int i = 0; i < n; i++) {
arr[i] = publish(perm);
rotate(perm.begin(), perm.end() - 1, perm.end());
}
int q_arr[n];
for (int i = 0; i < n; i++) {
int me = arr[i], nxt = arr[(i + 1) % n];
dbg(me, nxt);
q_arr[i] = (me - nxt + (n - 1)) / 2;
}
vector<int> ans(n);
for (int i = 0; i < n; i++) {
ans[q_arr[i]] = i + 1;
}
reverse(begin(ans), end(ans));
answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |