#include using namespace std; #define rep(i, n) for(int i=0; i #include int main() { int n; cin >> n; vector list(n + 1); rep(i, n + 1) { list[i] = i + 1; } vector ans; set res; rep(i, n) { res.insert(i + 1); } if (n <= 10) { vector> all; vector v(n); rep(i, n) { v[i] = i + 1; } do { all.push_back(v); } while (next_permutation(v.begin(), v.end())); int l = 0, r = all.size(); while (r > l + 1) { int mid = (l + r) / 2; cout << "? "; for (int x : all[mid]) { cout << x << " "; } cout << endl; int ret; cin >> ret; if (ret == 0) { r = mid; } else { l = mid; } } cout << "! "; for (int x : all[l]) { cout << x << " "; } cout << endl; return 0; } //int cnt = 0; rep(i, n) { int l = i, r = n; while (r > l + 1) { //Query int mid = (l + r) / 2; cout << "? "; for (int x : ans) { cout << x << " "; } cout << list[mid] << " "; for (int x : res) { if (x != list[mid]) { cout << x << " "; } } cout << endl; //cnt++; int ret; cin >> ret; if (ret == 0) { r = mid; } if (ret == 1) { l = mid; } } ans.push_back(list[l]); res.erase(list[l]); list[l] = -1; sort(list.begin(), list.end()); } cout << "! "; for (int x : ans) { cout << x << " "; } cout << endl; /* cout << "Query=" << cnt << endl; cout << "Limit=" << floor(floor((n - 1) * log2(n)) - (double)(n - 1) / 2 + 1) << endl; */ }