# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
644033 | Vladth11 | Art Collections (BOI22_art) | C++17 | 1656 ms | 688 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 "art.h"
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
const int bSize = 10;
const int bits = 15;
const int NMAX = 100000;
const int VMAX = NMAX * 89;
void solve(int N) {
int n = N;
vector<int> order;
for(int i = 1; i <= N; i++)
order.push_back(i);
int initial = publish(order);
for(int i = n - 1; i >= 1; i--){
vector <int> nou;
int spate = n - i, unde = 0, cc = 0;
for(auto x : order){
if(x != i){
nou.push_back(x);
}else{
unde = cc;
}
cc++;
}
nou.push_back(i);
int acum = publish(nou);
acum -= initial;
/// -a + A = acum
/// a + A = spate
/// -a = A - spate
/// A - spate + A = acum
/// 2A = acum + spate
int mari = (acum + spate) / 2;
int mici = spate - mari;
unde += mici;
for(int j = nou.size() - 1; j > unde; j--){
nou[j] = nou[j - 1];
}
nou[unde] = i;
acum += initial;
acum -= mari;
initial = acum;
order = nou;
}
answer(order);
}
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... |