0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-15 05:58:47 +00:00
OI-codes/Codeforces/1586/D/D.cpp

42 lines
831 B
C++
Raw Normal View History

#include <bits/stdc++.h>
using namespace std;
int n, k, a[105];
bool flag;
int main() {
cin >> n;
for (int i = 1; i < n; i++) {
cout << "? ";
for (int j = 1; j < n; j++) {
cout << i << ' ';
}
cout << n << endl;
cin >> k;
if (k != 0) {
a[n] = i;
a[k] = n;
break;
}
}
flag = !a[n];
if (flag) a[n] = n;
for (int p = 1; p < n; p++) {
if (!flag && p == a[n]) continue;
cout << "? ";
for (int i = 1; i < n; i++) {
cout << n - (flag ? 0 : p) << ' ';
}
cout << (flag ? p : n - a[n]) << endl;
cin >> k;
a[k] = p;
}
cout << "! ";
for (int i = 1; i <= n; i++) {
cout << a[i] << ' ';
}
cout << endl;
return 0;
}