QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#120170 | #6303. Inversion | hos_lyric | AC ✓ | 458ms | 3880kb | C++14 | 2.9kb | 2023-07-06 14:24:31 | 2023-07-06 14:25:16 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
int uf[2010];
int root(int u) {
return (uf[u] < 0) ? u : (uf[u] = root(uf[u]));
}
bool connect(int u, int v) {
u = root(u);
v = root(v);
if (u == v) return false;
if (uf[u] > uf[v]) swap(u, v);
uf[u] += uf[v];
uf[v] = u;
return true;
}
int N;
vector<int> P, Q;
int Ask(int l, int r) {
if (l == r) return 0;
assert(0 <= l); assert(l < r); assert(r <= N);
printf("? %d %d\n", l + 1, r);
fflush(stdout);
int ret;
scanf("%d", &ret);
return ret;
}
// inv[l, r) mod 2
int sub(int l, int r) {
int id = 0;
vector<int> ps(r-l, 0);
for (int x = 0; x < r; ++x) {
if (l <= Q[x]) {
ps[Q[x] - l] = id++;
}
}
fill(uf, uf + (r-l), -1);
for (int u = 0; u < r-l; ++u) {
connect(u, ps[u]);
}
int ret = r-l;
for (int u = 0; u < r-l; ++u) if (uf[u] < 0) {
--ret;
}
// cerr<<"sub ["<<l<<", "<<r<<"): "<<ps<<" "<<ret<<endl;
return (ret & 1);
}
// P[l] < P[r]
bool calc(int l, int r) {
int sum = 0;
sum ^= sub(l, r);
sum ^= sub(l + 1, r);
sum ^= Ask(l, r + 1);
sum ^= Ask(l + 1, r + 1);
return !(sum & 1);
}
int main() {
scanf("%d", &N);
P.assign(N, -1);
Q.assign(N, -1);
for (int i = 0; i < N; ++i) {
int lo = -1, hi = i;
for (; lo + 1 < hi; ) {
const int mid = (lo + hi) / 2;
(calc(Q[mid], i) ? lo : hi) = mid;
}
for (int x = hi; x < i; ++x) {
++P[Q[x]];
}
P[i] = hi;
for (int j = 0; j <= i; ++j) {
Q[P[j]] = j;
}
// cerr<<"P = "<<P<<", Q = "<<Q<<endl;
}
printf("!");
for (int i = 0; i < N; ++i) {
printf(" %d", P[i] + 1);
}
puts("");
fflush(stdout);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3572kb
input:
3 0 0 0 1
output:
? 1 2 ? 2 2 ? 1 3 ? 2 3 ! 2 3 1
result:
ok OK, guesses=4
Test #2:
score: 0
Accepted
time: 346ms
memory: 3640kb
input:
1993 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 0 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 0 0 0 0 1 0 1 1 0 1 0 0 0 0 1 0 1 0 0 1 0 0 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 0 0 0 0 1 0 0 1 0 1 1 0 0 1 0 1 1 0 1 1 0 1 1 0 0 1 0 0...
output:
? 1 2 ? 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8 8 ? 4 9 ? 5 9 ? 2 9 ? 3 9 ? 8 9 ? 9 9 ? 1 10 ? 2 10 ? 9 10 ? 10 10 ? 8 10 ? 9 10 ? 1 11 ? 2 11 ? 10 11 ? 11 11 ? 2 11 ? 3 ...
result:
ok OK, guesses=38220
Test #19:
score: 0
Accepted
time: 2ms
memory: 3576kb
input:
1
output:
! 1
result:
ok OK, guesses=0
Test #20:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
2 0 0
output:
? 1 2 ? 2 2 ! 1 2
result:
ok OK, guesses=2
Test #21:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
2 1 0
output:
? 1 2 ? 2 2 ! 2 1
result:
ok OK, guesses=2
Test #22:
score: 0
Accepted
time: 77ms
memory: 3684kb
input:
1997 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1...
output:
? 1 2 ? 2 2 ? 2 3 ? 3 3 ? 1 3 ? 2 3 ? 1 4 ? 2 4 ? 2 4 ? 3 4 ? 4 5 ? 5 5 ? 1 5 ? 2 5 ? 3 5 ? 4 5 ? 1 6 ? 2 6 ? 3 6 ? 4 6 ? 1 7 ? 2 7 ? 3 7 ? 4 7 ? 5 7 ? 6 7 ? 6 8 ? 7 8 ? 5 8 ? 6 8 ? 3 8 ? 4 8 ? 6 9 ? 7 9 ? 8 9 ? 9 9 ? 5 9 ? 6 9 ? 7 9 ? 8 9 ? 3 10 ? 4 10 ? 5 10 ? 6 10 ? 7 10 ? 8 10 ? 3 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