# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
834932 | vjudge1 | Zagonetka (COI18_zagonetka) | C++17 | 56 ms | 332 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>
#define ll long long
#define fi first
#define se second
using namespace std;
int main() {
int n, ans;
int p[105];
cin >> n;
for(int i=1; i<=n; i++) {
cin >> p[i];
}
vector<int>small,big,v;
for(int i=1; i<=n; i++) v.push_back(i);
while(next_permutation(v.begin(), v.end())) {
cout << "query ";
for(int i=0; i<v.size(); i++) {
cout << v[i] << " ";
}
cout << endl;
cin >> ans;
if(ans==1) {
if(small.empty()) {
small = v;
} else {
small = min(small, v);
}
if(big.empty()) {
big = v;
} else {
big = max(big, v);
}
}
}
cout << "end" << endl;
for(int i=0; i<small.size(); i++) cout << small[i] << " ";
cout << endl;
for(int i=0; i<big.size(); i++) cout << big[i] << " ";
cout << endl;
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... |