#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
2 ms |
208 KB |
Output is correct |
4 |
Correct |
2 ms |
208 KB |
Output is correct |
5 |
Correct |
5 ms |
208 KB |
Output is correct |
6 |
Correct |
8 ms |
208 KB |
Output is correct |
7 |
Correct |
8 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |