이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define PB push_back
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
using namespace std;
const int N = 100100;
vector<vector<int> > ans;
vector<int> vc;
int n, p[N];
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
// freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> n;
assert(n <= 6);
for (int i = 1; i <= n; i++)
cin >> p[i];
for (int i = 1; i <= n; i++)
vc.PB(i);
do{
cout << "query";
for (int cr : vc)
cout << " " << cr;
cout << endl;
int res; cin >> res;
if (res == 1)
ans.PB(vc);
} while (next_permutation(all(vc)));
sort(all(ans));
cout << "end" << endl;
for (int cr : ans[0]) {
cout << cr;
if (cr == ans[0].back())
cout << endl;
else cout << " ";
}
for (int cr : ans.back()) {
cout << cr;
if (cr == ans.back().back())
cout << endl;
else cout << " ";
}
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... |