QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#96727 | #6303. Inversion | joesmitty | AC ✓ | 325ms | 3616kb | C++20 | 6.0kb | 2023-04-15 08:56:53 | 2023-04-15 08:56:55 |
Judging History
answer
#include <iostream>
#include <tuple>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <random>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <vector>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <cctype>
#include <climits>
#include <chrono>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector< vector <int> > vvi;
typedef pair<int, int> pii;
typedef pair < pair < int, int >, int > piii;
typedef pair < pair <int, int > , pair <int, int> > piiii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
#define FOR(i,a,b) for(int i = a; i < b; i ++)
#define RFOR(i,a,b) for(int i = a-1; i >= b; i --)
#define all(a) a.begin(), a.end()
//#define endl '\n';
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
template <typename T>
void pr(vector<T> &v) {
FOR(i, 0, sz(v)) cout << v[i] << " ";
cout << endl;
}
template <typename T>
void pr(vector<vector<T> > &v) {
FOR(i, 0, sz(v)) { pr(v[i]); }
}
template <typename T>
void re(T &x) {
cin >> x;
}
template <typename T>
void re(vector<T> &a) {
FOR(i, 0, sz(a)) re(a[i]);
}
template <class Arg, class... Args>
void re(Arg &first, Args &... rest) {
re(first);
re(rest...);
}
template <typename T>
void pr(T x) {
cout << x << endl;
}
template <class Arg, class... Args>
void pr(const Arg &first, const Args &... rest) {
cout << first << " ";
pr(rest...);
cout << endl;
}
void ps() { cout << endl; }
template<class T, class... Ts>
void ps(const T& t, const Ts&... ts) {
cout << t; if (sizeof...(ts)) cout << " "; ps(ts...);
}
const ll MOD = 998244353;
#define inf 1e18;
#define INF INT_MAX
long double PI = 4*atan(1);
long double eps = 1e-16;
template<class T>
class FenwickTree {
private:
vector<T> ft;
public:
FenwickTree(int m) {
ft.assign(m + 5, 0);
}
int LSOne(int x) {
return x & (-x);
}
T RSQ(int j) {
// this allows array to be 0 indexed while ft is 1 indexed
j++;
ll sum = 0;
for(; j > 0; j -= LSOne(j)) {
sum += ft[j];
}
return sum;
}
void update(int i, T v) {
i++;
for(; i < ft.size(); i += LSOne(i)) {
ft[i] += v;
}
}
};
vector<int> ans(1);
vi test;
int numq = 0;
// int calcinv(int l, int r) {
// int ans = 0;
// FOR(i,l,r) {
// FOR(j,i+1, r+1) {
// if(test[i] > test[j]) {
// //cout << i << " " << j << " " << test[i] << " " << test[j] << endl;
// ans++;
// }
// }
// }
// //cout << "inv: " << l << " " << r << " " << ans << endl;
// return ans % 2;
// }
void add(int p) {
vector<int> loc(p);
FOR(i,0,p) loc[ans[i]] = i;
FenwickTree<int> ft(p+1);
vi inv(p+1);
RFOR(i,p,0) {
inv[i] = (inv[i+1] + ft.RSQ(ans[i]))%2;
ft.update(ans[i], 1);
}
int lo = 0;
int hi = p;
while(lo < hi) {
int mid = (lo + hi)/2;
//cout << lo << " " << hi << " " << mid << " " << loc[mid] << endl;
int pos = loc[mid];
int res = 0;
if(pos + 1 == p) {
cout << "? " << pos + 1 << " " << p + 1 << endl;
cin >> res;
// res = calcinv(pos, p);
numq += 1;
} else {
int r1,r2,r3,r4;
cout << "? " << pos + 1 << " " << p + 1 << endl;
cin >> r1;
//r1 = calcinv(pos, p);
cout << "? " << pos + 2 << " " << p + 1 << endl;
cin >> r2;
//r2 = calcinv(pos+1, p);
// cout << "? " << pos + 1 << " " << p << endl;
//cin >> r3;
r3 = inv[pos];
// cout << "? " << pos + 2 << " " << p << endl;
//cin >> r4;
r4 = inv[pos+1];
numq += 2;
res = (4 + r1 - r2 - r3 + r4) % 2;
}
if(res == 1) {
hi = mid;
} else {
lo = mid + 1;
}
}
int newpos = lo;
// cout << newpos << endl;
vector<int> nans(p+1);
for(int i = 0; i < p; i++) {
if(ans[i] < newpos) {
nans[i] = ans[i];
} else {
nans[i] = ans[i] + 1;
}
}
nans[p] = newpos;
//cout << numq << endl;
swap(ans, nans);
}
int main() {
auto start = chrono::high_resolution_clock::now();
// ios_base::sync_with_stdio(0);cin.tie(0);
//ofstream cout("output.txt");
//ifstream cin("input.txt");
#ifdef DEBUG
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n; cin >> n;
// test.resize(n);
// FOR(i,0,n) test[i] = i;
// default_random_engine g{1};
// shuffle(test.begin(), test.end(), g);
for(int i = 1; i < n; i++) {
add(i);
}
// bool good =true;
// FOR(i,0,n) {
// cout << test[i] << " " << ans[i] << endl;
// if(test[i] != ans[i]) {
// good =false;
// }
// }
// if(!good) {
// cout << "BAD" << endl;
// }
// cout << numq << endl;
cout << "! ";
for(auto x : ans) {
cout << x + 1 << " ";
}
cout << endl;
// auto stop = chrono::high_resolution_clock::now();
// auto duration = chrono::duration_cast<chrono::microseconds>(stop - start);
// cout << duration.count() << endl;
//cin.close();
//cout.close();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3384kb
input:
3 0 1 0 1
output:
? 1 2 ? 2 3 ? 1 3 ? 2 3 ! 2 3 1
result:
ok OK, guesses=4
Test #2:
score: 0
Accepted
time: 242ms
memory: 3536kb
input:
1993 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 1 0 1 0 1 0 1 0 0 1 0 1 1 0 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 1 1 1 0 0 1 1 0 0 0 0 1 0 1 1 1 0 0 0 1 0 0 0 1 0 0 1 1 0 0 0 1 1 1 0 0 1 1 0 1 1 1 1 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 0 0 1 1 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 ? 5 11 ? 6 11 ? 1 11 ? 2 11 ? 11 12 ? 10 12 ? 11 12 ? 7 12 ? 8 12...
result:
ok OK, guesses=38262
Test #19:
score: 0
Accepted
time: 2ms
memory: 3340kb
input:
1
output:
! 1
result:
ok OK, guesses=0
Test #20:
score: 0
Accepted
time: 0ms
memory: 3324kb
input:
2 0
output:
? 1 2 ! 1 2
result:
ok OK, guesses=1
Test #21:
score: 0
Accepted
time: 0ms
memory: 3428kb
input:
2 1
output:
? 1 2 ! 2 1
result:
ok OK, guesses=1
Test #22:
score: 0
Accepted
time: 266ms
memory: 3608kb
input:
1997 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 0 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 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 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1...
output:
? 1 2 ? 1 3 ? 2 3 ? 1 4 ? 2 4 ? 2 4 ? 3 4 ? 1 5 ? 2 5 ? 3 5 ? 4 5 ? 1 6 ? 2 6 ? 5 6 ? 3 6 ? 4 6 ? 6 7 ? 5 7 ? 6 7 ? 6 8 ? 7 8 ? 5 8 ? 6 8 ? 3 8 ? 4 8 ? 3 9 ? 4 9 ? 5 9 ? 6 9 ? 7 9 ? 8 9 ? 3 10 ? 4 10 ? 7 10 ? 8 10 ? 5 10 ? 6 10 ? 8 11 ? 9 11 ? 7 11 ? 8 11 ? 9 11 ? 10 11 ? 8 12 ? 9 12 ? 7 12 ? 8 12 ?...
result:
ok OK, guesses=35867
Test #23:
score: 0
Accepted
time: 198ms
memory: 3500kb
input:
1998 1 1 0 1 1 1 1 1 1 1 0 1 1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