#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;
bool ask(){
cout << "query ";
for(int i = 1; i <= n; ++i) cout << a[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 = i + 1; j <= n; ++j){
swap(a[i], a[j]);
bool ok = ask();
swap(a[i], a[j]);
if(!ok && abs(a[i] - a[j]) < wr1 - wr2) wr1 = max(a[i], a[j]), wr2 = min(a[i], a[j]);
}
}
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 << endl;
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 |
0 ms |
208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
73 ms |
208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |