#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n, i, maxV=0, v;
cin>>n;
int 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]<<" ";
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 4ms | 1744 KiB | ||||
subtask2 | 0/10 | ||||||
2 | Time limit exceeded | 12ms | 1300 KiB | ||||
3 | Time limit exceeded | 16ms | 1468 KiB | ||||
subtask3 | 0/30 | ||||||
4 | Time limit exceeded | 61ms | 1608 KiB | ||||
5 | Time limit exceeded | 239ms | 1828 KiB | ||||
6 | Time limit exceeded | 238ms | 2092 KiB | ||||
7 | Time limit exceeded | 239ms | 2212 KiB | ||||
8 | Time limit exceeded | 61ms | 2536 KiB | ||||
9 | Time limit exceeded | 239ms | 2652 KiB | ||||
subtask4 | 0/20 | ||||||
10 | Time limit exceeded | 474ms | 3032 KiB | ||||
11 | Time limit exceeded | 476ms | 3280 KiB | ||||
12 | Time limit exceeded | 476ms | 3040 KiB | ||||
13 | Time limit exceeded | 479ms | 3348 KiB | ||||
subtask5 | 0/40 | ||||||
14 | Time limit exceeded | 1.8s | 3412 KiB | ||||
15 | Time limit exceeded | 1.914s | 3512 KiB | ||||
16 | Time limit exceeded | 1.796s | 3448 KiB | ||||
17 | Time limit exceeded | 1.661s | 3352 KiB | ||||
18 | Time limit exceeded | 2.328s | 3280 KiB | ||||
19 | Time limit exceeded | 1.824s | 3392 KiB | ||||
20 | Time limit exceeded | 1.907s | 3392 KiB | ||||
21 | Time limit exceeded | 1.909s | 3756 KiB |