QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#636709 | #9432. Permutation | Cai_Guang | AC ✓ | 292ms | 5464kb | C++23 | 7.7kb | 2024-10-13 02:10:58 | 2024-10-13 02:10:59 |
Judging History
answer
// _/_/_/ _/ _/_/_/
// _/ _/_/_/ _/ _/ _/ _/_/_/ _/_/_/ _/_/_/
// _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
// _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
// _/_/_/ _/_/_/ _/ _/_/_/ _/_/_/ _/_/_/ _/ _/ _/_/_/
// _/_/_/_/_/ _/
// _/_/_/
// Problem: K. Permutation
// Contest: Codeforces - The 2024 ICPC Kunming Invitational Contest
// URL: https://codeforces.com/gym/105386/problem/K
// Memory Limit: 1024 MB
// Time Limit: 4000 ms
// Editor: Cai_Guang
// Time: 2024-10-13 00:03:13
#include <bits/stdc++.h>
using namespace std;
#define int long long
#ifndef Cai_Guang
#define debug //
#define test //
#endif
struct DSU {
int n;
int szn, szm;
std::vector<int> fa, sz, cnt;
DSU(int n) {
this -> n = n;
fa.resize(n + 10);
sz.resize(n + 10);
cnt.resize(n + 10);
for(int i = 0; i <= n; i++) {
fa[i] = i;
sz[i] = 1;
cnt[i] = 0;
}
}
DSU(int n_, int m_) {
this -> n = n_ * m_;
szn = n_, szm = m_;
fa.resize(n + 10);
sz.resize(n + 10);
cnt.resize(n + 10);
for(int i = 0; i <= n; i++) {
fa[i] = i;
sz[i] = 1;
cnt[i] = 0;
}
}
DSU() {}
int get(int x, int y) {
return (x - 1) * szm + y;
}
int findf(int x) {
if(x == fa[x]) {
return x;
} return fa[x] = findf(fa[x]);
}
int findf(int x, int y) {
return findf(get(x, y));
}
bool smerge(int x, int y) {
int fx = findf(x), fy = findf(y);
cnt[fx] ++;
if(fx == fy) return false;
if(sz[fx] < sz[fy]) {
std::swap(fx, fy);
} else {
}
fa[fy] = fx;
sz[fx] += sz[fy];
cnt[fx] += cnt[fy];
return true;
}
bool smerge(int x, int y, int xx, int yy) {
return smerge(get(x, y), get(xx, yy));
}
bool merge(int x, int y) {
int fx = findf(x), fy = findf(y);
cnt[fy] ++;
if(fx == fy) return false;
fa[fx] = fy;
sz[fy] += sz[fx];
cnt[fy] += cnt[fx];
return true;
}
bool merge(int x, int y, int xx, int yy) {
return merge(get(x, y), get(xx, yy));
}
bool same(int x, int y) {
int fx = findf(x), fy = findf(y);
if(fx == fy) return true;
return false;
}
bool same(int x, int y, int xx, int yy) {
return same(get(x, y), get(xx, yy));
}
};
struct Interactor {
const int LIMIT = 7777;
bool DEBUG;
int n;
int cnt = 0;
std::vector<int> a;
Interactor() {}
Interactor(int n) : n(n), DEBUG(false) {}
Interactor(int n, std::vector<int> a) : n(n), a(a), DEBUG(true) {}
int read() {
return n;
}
void check() {
cnt ++;
assert(cnt <= LIMIT);
}
int get(std::vector<int> b) {
if (DEBUG) {
int ret = 0;
for (int i = 1; i <= n; i++) {
if (a[i] == b[i]) {
ret ++;
}
}
// std::cout << "get() = " << ret << std::endl;
return ret;
}
int x;
std::cin >> x;
return x;
}
int query(std::vector<int> b) {
cnt++;
std::cout << "0 ";
for (int i = 1; i <= n; i++) {
std::cout << b[i] << " ";
} std::cout << std::endl;
return get(b);
}
int answer(std::vector<int> b) {
std::cout << "1 ";
for (int i = 1; i <= n; i++) {
std::cout << b[i] << " ";
} std::cout << std::endl;
if (DEBUG) {
assert(a == b);
}
return get(b);
}
};
void solve() {
int n = 1000;
std::cin >> n;
std::vector<int> vec(n + 1);
std::iota(vec.begin(), vec.end(), 0);
Interactor itr(n);
// Interactor itr(n, vec);
// n = itr.read();
if (n == 1) {
itr.answer({0, 1});
return;
}
std::vector<int> np(n + 1);
for (int i = 1; i <= n; i++) {
np[i] = i;
}
std::random_shuffle(np.begin() + 1, np.end());
std::vector<int> f(n + 1);
for (int i = 1; i <= n / 2; i++) {
f[i] = 1;
}
for (int i = n / 2 + 1; i <= n; i++) {
f[i] = 2;
}
std::vector<std::vector<int>> yes, no;
for (int i = 1; i <= 100; i++) {
std::random_shuffle(f.begin() + 1, f.end());
int x = itr.query(f);
if (x == 0) {
no.push_back(f);
} else if (x == 2) {
yes.push_back(f);
}
}
std::vector<int> is(n + 1, 1), ans(n + 1);
for (auto x : yes) {
for (int i = 1; i <= n; i++) {
is[i] &= x[i] == 1;
}
}
for (auto x : no) {
for (int i = 1; i <= n; i++) {
is[i] &= x[i] == 2;
}
}
int pos = 0;
for (int i = 1; i <= n; i++) {
if (is[i]) {
pos = i;
break;
}
}
// std::cout << pos << '\n';
std::map<std::pair<int, int>, std::set<int>> have;
std::map<std::pair<int, int>, std::vector<std::pair<int, int>>> mp;
for (int i = 2; i <= n; i ++) {
have[{1, n}].insert(i);
}
int d = 0;
std::function<void(int, int)> solve = [&](int l, int r) {
int len = r - l + 1;
std::vector<int> s;
if (d) std::cout << "$$$$$$$\n";
if (d) std::cout << l << " " << r << std::endl;
for (auto x : have[{l, r}]) {
s.push_back(x);
if (d) std::cout << x << " ";
}
if (d) std::cout << "\n";
if (l == r && r == pos) {
ans[l] = 1;
return;
}
if (len == 1) {
ans[l] = s[0];
return;
}
if (len == 2 && l == pos) {
ans[r] = s[0];
return;
}
if (len == 2 && r == pos) {
ans[l] = s[0];
return;
}
std::random_shuffle(s.begin(), s.end());
DSU dsu(n + 3);
int left = n + 1, right = n + 2;
int lst = 0;
int mid = (l + r) >> 1;
for (int i = 0; i < s.size(); i++) {
int L, R;
if (lst) {
L = lst;
R = s[i];
} else {
L = s[i];
lst = L;
i ++;
if (i >= s.size()) break;
R = s[i];
}
if(d) std::cout << "!!!" << s.size() << " " << L << " " << R << "\n";
std::vector<int> q(n + 1, 1);
for (int i = l; i <= mid; i++) {
if (i != pos) {
q[i] = L;
}
}
for (int i = mid + 1; i <= r; i++) {
if (i != pos) {
q[i] = R;
}
}
int x = itr.query(q);
if (x == 3) {
dsu.merge(left, L);
dsu.merge(right, R);
lst = 0;
} else if (x == 1) {
dsu.merge(left, R);
dsu.merge(right, L);
lst = 0;
} else {
dsu.merge(L, R);
lst = L;
}
}
if (lst) {
std::vector<int> q(n + 1, 1);
for (int i = l; i <= mid; i++) {
if (i != pos) q[i] = lst;
}
int x = itr.query(q);
if (x == 2) {
dsu.merge(lst, left);
} else {
dsu.merge(lst, right);
}
}
for (int i = 1; i <= n; i++) {
if (dsu.same(i, left)) {
have[{l, mid}].insert(i);
}
if (dsu.same(i, right)) {
have[{mid + 1, r}].insert(i);
}
}
solve(l, mid); solve(mid + 1, r);
};
solve(1, n);
ans[pos] = 1;
itr.answer(ans);
// std::cout << itr.cnt << "\n";
}
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
#ifdef Cai_Guang
//freopen("1.in", "r", stdin);
localTest = true;
#endif
srand(time(NULL));
int t = 1;
// std::cin >> t;
while(t--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3880kb
input:
5 2 2 0 1 2 1 1 2 0 0 2 2 1 0 2 0 0 0 0 1 0 2 2 2 0 1 1 1 2 0 1 1 2 0 1 2 2 0 0 0 1 1 0 0 1 1 2 1 2 2 2 1 0 1 0 1 1 0 0 1 2 1 0 2 0 0 1 1 0 0 2 0 1 2 2 2 0 1 0 1 0 2 1 1 1 2 0 0 1 0 0 2 1 1 2 2 1 0 1 1 3 2 2 3 2 3
output:
0 2 1 2 1 2 0 1 2 2 1 2 0 1 2 1 2 2 0 1 1 2 2 2 0 1 2 2 1 2 0 1 2 2 2 1 0 1 2 2 2 1 0 2 1 2 1 2 0 2 2 1 2 1 0 2 1 1 2 2 0 2 1 2 1 2 0 1 2 2 1 2 0 2 2 1 1 2 0 2 2 1 2 1 0 2 2 2 1 1 0 2 1 1 2 2 0 1 2 1 2 2 0 2 2 1 2 1 0 2 1 1 2 2 0 1 1 2 2 2 0 2 2 1 2 1 0 2 2 2 1 1 0 1 2 2 1 2 0...
result:
ok Accepted
Test #2:
score: 0
Accepted
time: 283ms
memory: 5376kb
input:
1000 2 1 1 0 2 0 1 0 1 1 2 1 1 0 1 1 0 1 1 1 2 2 0 0 1 2 1 1 1 1 1 0 2 0 0 1 0 1 2 2 1 1 1 0 0 1 1 0 1 1 2 1 1 0 1 1 1 0 2 2 2 1 2 0 1 0 1 0 1 1 1 1 2 2 1 1 1 2 2 1 1 1 2 1 0 2 1 1 2 2 2 2 2 1 0 1 1 2 0 1 3 3 2 3 3 2 1 3 1 2 2 2 3 3 1 2 2 3 1 1 2 2 2 2 2 2 1 2 2 3 2 3 3 1 2 3 2 2 3 3 2 1 3 2 2 2 1 2...
output:
0 2 1 1 2 1 2 2 2 1 2 1 2 2 1 2 1 2 1 2 2 2 1 2 2 1 1 2 2 1 1 2 2 1 2 2 2 2 2 1 2 2 1 2 1 2 1 1 2 2 1 1 1 2 1 2 1 2 1 2 2 1 1 2 2 1 2 1 1 2 2 1 2 2 1 1 2 2 1 2 1 2 2 1 2 2 2 1 2 2 2 1 2 2 2 2 2 1 1 1 2 1 1 2 1 1 1 1 2 2 1 1 1 2 2 2 2 2 2 1 1 2 2 2 2 1 2 1 2 2 1 1 1 1 2 2 1 2 1 1 2 2 1 2 2 1 1 2 1 1 ...
result:
ok Accepted
Test #3:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
1
output:
1 1
result:
ok Accepted
Test #4:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
2 0 0 0 2 0 2 2 2 2 2 2 2 0 0 2 2 2 2 0 0 2 0 2 0 0 2 0 0 0 0 2 2 0 0 0 0 2 0 2 2 0 2 0 2 2 0 0 2 0 2 2 0 2 2 0 0 2 0 0 0 0 0 2 0 0 0 0 0 2 2 0 2 2 2 0 0 0 0 0 0 0 0 2 2 0 2 2 0 0 2 0 2 2 0 2 0 2 2 2 0
output:
0 1 2 0 1 2 0 1 2 0 2 1 0 1 2 0 2 1 0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