# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1097740 | Yadav1992 | Art Collections (BOI22_art) | C++17 | 0 ms | 0 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>
#include <vector>
using namespace std;
#define ll long long
#define mod 1000000007
vector<int> getInitialVector(int N) {
vector<int> result(N, 0);
for(int i = 1; i <= N; i++){
result[i-1] = i;
}
return result;
}
int getPosition(int prev, int cur, int N) {
return (cur - prev + N)/2;
}
void solve(int N)
{
vector<int> R = getInitialVector(N);
vector<int> A(N, -1);
int prevCount = publish(R);
for(int i = 1; i < N; i++) {
int cur = R[N-1];
R.pop_back();
R.insert(R.begin(), cur);
int curCount = publish(R);
int position = getPosition(prevCount, curCount, N);
A[position] = cur;
prevCount = curCount;
}
for(int i = 0; i < N; i++) {
if(A[i] == -1) {
A[i] = 1;
break;
}
}
answer(A);
}