#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
long long n, i, maxV=0, v;
cin>>n;
long long a[n], maxA[n];
for (i=0; i<n; i++)
{
cin>>a[i];
}
sort(a, a+n);
do
{
cout<<"? ";
for (i=0; i<n; i++)
{
cout<<a[i]<<" ";
}
cout.flush();
cin>>v;
if (v>maxV)
{
maxV=v;
for (i=0; i<n; i++)
{
maxA[i]=a[i];
}
}
}while (next_permutation(a, a+n));
cout<<"! ";
for (i=0; i<n; i++)
{
cout<<maxA[i]<<" ";
}
cout.flush();
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 4ms | 1876 KiB | ||||
subtask2 | 10/10 | ||||||
2 | Accepted | 469ms | 2276 KiB | ||||
3 | Accepted | 490ms | 2128 KiB | ||||
subtask3 | 0/30 | ||||||
4 | Time limit exceeded | 5.018s | 1532 KiB | ||||
5 | Time limit exceeded | 5.045s | 1680 KiB | ||||
6 | Time limit exceeded | 5.038s | 1824 KiB | ||||
7 | Time limit exceeded | 5.014s | 2016 KiB | ||||
8 | Time limit exceeded | 5.019s | 2168 KiB | ||||
9 | Time limit exceeded | 5.035s | 2164 KiB | ||||
subtask4 | 0/20 | ||||||
10 | Time limit exceeded | 5.046s | 2292 KiB | ||||
11 | Time limit exceeded | 5.03s | 2428 KiB | ||||
12 | Time limit exceeded | 5.034s | 2388 KiB | ||||
13 | Time limit exceeded | 5.057s | 2684 KiB | ||||
subtask5 | 0/40 | ||||||
14 | Time limit exceeded | 5.039s | 2744 KiB | ||||
15 | Time limit exceeded | 5.041s | 2664 KiB | ||||
16 | Time limit exceeded | 5.001s | 3144 KiB | ||||
17 | Time limit exceeded | 5.039s | 3076 KiB | ||||
18 | Time limit exceeded | 5.068s | 2884 KiB | ||||
19 | Time limit exceeded | 5.001s | 2768 KiB | ||||
20 | Accepted | 2.061s | 3912 KiB | ||||
21 | Time limit exceeded | 5.067s | 2876 KiB |