# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1044093 | vjudge1 | Zagonetka (COI18_zagonetka) | C++17 | 46 ms | 592 KiB |
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;
void print(vector<int> v)
{
for(int i = 0; i + 1 < v.size(); i++)
cout << v[i] << ' ';
cout << v.back() << endl;
}
bool ask(vector<int> v)
{
cout << "query ";
print(v);
bool res;
cin >> res;
return res;
}
void out(vector<int> a, vector<int> b)
{
cout << "end\n";
print(a);
print(b);
exit(0);
}
int main()
{
int n;
cin >> n;
vector<int> p(n), a, b;
for(int i = 0; i < n; i ++)
cin >> p[i];
a = b = p;
sort(p.begin(), p.end());
do
{
bool res = ask(p);
if(res)
a = min(a, p), b = max(a, p);
}
while(next_permutation(p.begin(), p.end()));
out(a, b);
return 0;
}
Compilation message (stderr)
# | 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... |