Submission #240775

#TimeUsernameProblemLanguageResultExecution timeMemory
240775VimmerZagonetka (COI18_zagonetka)C++14
9 / 100
12 ms396 KiB
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //#pragma GCC optimize("unroll-loops") //#pragma GCC optimize("-O3") //#pragma GCC optimize("Ofast") //#pragma GCC optimize("fast-math") //#pragma GCC optimize("no-stack-protector") #define F first #define S second #define sz(x) int(x.size()) #define pb push_back #define N 101001 #define M ll(998244353) #define inf 1e9 + 1e9 using namespace std; //using namespace __gnu_pbds; typedef long double ld; typedef long long ll; typedef short int si; typedef array <int, 3> a3; //typedef tree <int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; vector <int> mn, mx, g; int n, mk[N]; bool gd(vector <int> &g) { cout << "query "; for (auto it : g) cout << it << " "; cout << endl; bool t; cin >> t; return t; } bool lower(vector <int> &a, vector <int> &b) { for (int i = 0; i < sz(a); i++) { if (a[i] == b[i]) continue; return a[i] < b[i]; } return 1; } void rec(int v) { if (v == n) { if (gd(g)) { if (sz(mn) == 0 || lower(g, mn)) mn = g; if (sz(mx) == 0 || lower(mx, g)) mx = g; } return; } for (int i = 1; i <= n; i++) { if (mk[i]) continue; mk[i] = 1; g.pb(i); rec(v + 1); g.pop_back(); mk[i] = 0; } } int main() { //freopen("input.txt", "r", stdin); //freopen("output4.txt", "w", stdout); ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; vector <int> vr(n); for (int i = 0; i < n; i++) cin >> vr[i]; if (n <= 6) { rec(0); cout << "end" << endl; for (auto it : mn) cout << it << " "; cout << endl; for (auto it : mx) cout << it << " "; cout << endl; exit(0); } int l = 0, r = 0; for (int i = 0; i < n && l == 0; i++) { vector <int> gr = vr; for (int j = i + 1; j < n && l == 0; j++) { swap(gr[j - 1], gr[j]); if (gd(gr)) continue; l = gr[j]; r = gr[j - 1]; } } for (int i = 1; i <= n; i++) { if (i != l && i != r) {mn.pb(i); continue;} if (i == r && l < i) {mn.pb(i); continue;} if (i == l && r > i) {mn.pb(i); continue;} else if (i == l) {mn.pb(i); mn.pb(r); continue;} } for (int i = n; i >= 1; i--) { if (i != l && i != r) {mx.pb(i); continue;} if (i == r && l > i) {mx.pb(i); continue;} if (i == l && r < i) {mx.pb(i); continue;} else if (i == l) {mx.pb(i); mx.pb(r); continue;} } cout << "end" << endl; for (auto it : mn) cout << it << " "; cout << endl; for (auto it : mx) cout << it << " "; cout << endl; }

Compilation message (stderr)

zagonetka.cpp: In function 'bool gd(std::vector<int>&)':
zagonetka.cpp:38:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (auto it : g) cout << it << " "; cout << endl;
     ^~~
zagonetka.cpp:38:42: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     for (auto it : g) cout << it << " "; cout << endl;
                                          ^~~~
zagonetka.cpp: In function 'int main()':
zagonetka.cpp:107:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
         for (auto it : mn) cout << it << " "; cout << endl;
         ^~~
zagonetka.cpp:107:47: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
         for (auto it : mn) cout << it << " "; cout << endl;
                                               ^~~~
zagonetka.cpp:109:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
         for (auto it : mx) cout << it << " "; cout << endl;
         ^~~
zagonetka.cpp:109:47: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
         for (auto it : mx) cout << it << " "; cout << endl;
                                               ^~~~
zagonetka.cpp:152:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (auto it : mn) cout << it << " "; cout << endl;
     ^~~
zagonetka.cpp:152:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     for (auto it : mn) cout << it << " "; cout << endl;
                                           ^~~~
zagonetka.cpp:154:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (auto it : mx) cout << it << " "; cout << endl;
     ^~~
zagonetka.cpp:154:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     for (auto it : mx) cout << it << " "; cout << endl;
                                           ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...