#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x) x.begin(), x.end()
const int M = 200007;
const ll inf = 2e9;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
const double eps = 1e-6;
const int dx[] = {0, -1, 0, 1}, dy[] = {1, 0, -1, 0};
const int block = 320;
int n, a[M], wr1 = inf, wr2, b[M];
bool ask(){
cout << "query ";
for(int i = 1; i <= n; ++i) cout << b[i] << " ";
cout << endl;
bool ret; cin >> ret;
return ret;
}
int main(){
// ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
for(int i = 1; i <= n; ++i) cin >> a[i];
for(int i = 1; i <= n; ++i){
for(int j = 1; j <= n; ++j){
b[j] = a[j];
if(a[j] <= a[i]) ++b[j];
}
b[i] = 1;
if(!ask()) wr1 = a[i];
}
for(int i = 1; i <= n; ++i){
for(int j = 1; j <= n; ++j){
b[j] = a[j];
if(a[j] >= a[i]) --b[j];
}
b[i] = n;
if(!ask()) wr2 = a[i];
}
cout << "end\n";
int emp = 0;
for(int i = 1; i <= n; ++i){
if(!emp && a[i] == wr1){
emp = i;
cout << i + 1 << " ";
}
else if(a[i] == wr2){
if(emp) cout << emp << " ";
else cout << i << " ";
emp = -1;
}
else cout << i << " ";
}
cout << endl;
emp = 0;
for(int i = 1; i <= n; ++i){
if(!emp && a[i] == wr2){
emp = i;
cout << n - i << " ";;
}
else if(a[i] == wr1){
if(emp) cout << emp << " ";
else cout << n - i + 1 << " ";
emp = -1;
}
else cout << n - i + 1 << " ";
}
cout << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |