# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1172193 | lopkus | Mouse (info1cup19_mouse) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
auto ask = [&] (std::vector<int> tt) {
std::cout << "? ";
for(auto x : tt) {
std::cout << x << " ";
}
std::cout << std::endl;
int x;
std::cin >> x;
return x;
};
int n;
std::cin >> n;
std::vector<int> p(n);
iota(p.begin(), p.end(), 1);
int curr = ask(p);
for(int i = 0; i < n; i++) {
for(int j = i + 1; j < n; j++) {
std::vector<int> newp = p;
std::swap(newp[i], newp[j]);
int newcurr = ask(newp);
if(newcurr > curr) {
std::swap(p[i], p[j]);
curr = newcurr;
break;
}
}
}
std::cout << "! ";
for(auto x : p) {
std::cout << x << " ";
}
}