#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n, a[N];
int main()
{
cin.tie(0); ios_base::sync_with_stdio(0);
cin >> n;
for(int i = 1; i <= n; i++) cin >> a[i];
if(n <= 6) {
vector<int> p, mx, mn;
for(int i = 1; i <= n; i++) p.push_back(i);
do {
cout << "query ";
for(int i = 0; i < n; i++) {
cout << p[i] << " ";
}
cout << endl;
int x; cin >> x;
if(x) {
if(mx.empty()) {
mx = p;
} else {
if(p > mx) mx = p;
}
if(mn.empty()) mn = p;
else if(p < mn) mn = p;
}
} while(next_permutation(p.begin(), p.end()));
cout << "end\n";
for(auto i : mn) cout << i << " ";
for(auto i : mx) cout << i << " ";
cout << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
2 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
8 ms |
208 KB |
Output is correct |
6 |
Correct |
7 ms |
208 KB |
Output is correct |
7 |
Correct |
5 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 |
- |