// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")
// #include <bits/extc++.h>
// using namespace __gnu_pbds;
#include <bits/stdc++.h>
using namespace std;
#define int long long
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;
#define X first
#define Y second
#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
mt19937 __gen = mt19937(__rd()); \
uniform_int_distribution<int> __dis(0, 1); \
auto rnd = bind(__dis, __gen);
const int INF = 1E18;
const int mod = 1E9 + 7;
int32_t main() {
fastIO();
int n, fl = 1, res;
cin >> n;
vector<int> v(n), minAns, maxAns;
for (auto &x : v) cin >> x;
for (int i = 0; i < n; ++i) v[i] = i + 1;
do {
cout << "query ";
for (auto x : v) cout << x << " "; cout << endl;
cin >> res;
if (res and fl) minAns = v, fl = 0;
if (res) maxAns = v;
} while (next_permutation(v.begin(), v.end()));
cout << "end\n";
for (auto x : minAns) cout << x << " "; cout << "\n";
for (auto x : maxAns) cout << x << " "; cout << "\n";
cout << flush;
return 0;
}
Compilation message
zagonetka.cpp: In function 'int32_t main()':
zagonetka.cpp:44:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for (auto x : v) cout << x << " "; cout << endl;
^~~
zagonetka.cpp:44:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
for (auto x : v) cout << x << " "; cout << endl;
^~~~
zagonetka.cpp:52:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for (auto x : minAns) cout << x << " "; cout << "\n";
^~~
zagonetka.cpp:52:45: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
for (auto x : minAns) cout << x << " "; cout << "\n";
^~~~
zagonetka.cpp:53:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for (auto x : maxAns) cout << x << " "; cout << "\n";
^~~
zagonetka.cpp:53:45: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
for (auto x : maxAns) cout << x << " "; cout << "\n";
^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
5 ms |
248 KB |
Output is correct |
3 |
Correct |
6 ms |
248 KB |
Output is correct |
4 |
Correct |
9 ms |
248 KB |
Output is correct |
5 |
Correct |
10 ms |
376 KB |
Output is correct |
6 |
Correct |
12 ms |
248 KB |
Output is correct |
7 |
Correct |
12 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3079 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3025 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3068 ms |
248 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |