This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
bool ask(vector<int>&v){
cout << "query ";
for(auto &x: v) cout << x << " ";
cout << endl;
bool ret; cin >> ret;
return ret;
}
void st1(int n){
vector<int>v(n);
for(int i = 0; i < n; i++) cin >> v[i];
sort(v.begin(), v.end());
vector<int>mini(n, 1e9), maxi(n, -1);
do{
if(ask(v)){
if(v < mini) mini = v;
if(v > maxi) maxi = v;
}
} while (next_permutation(v.begin(), v.end()));
cout << "end" << endl;
for(auto &x: mini) cout << x << " ";
cout << endl;
for(auto &x: maxi) cout << x << " ";
cout << endl;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n; cin >> n;
if(n <= 6) st1(n);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |