21342022-12-21 12:13:32TimiNomekopcpp11Time limit exceeded 10/1005.068s3912 KiB
#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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted4ms1876 KiB
subtask210/10
2Accepted469ms2276 KiB
3Accepted490ms2128 KiB
subtask30/30
4Time limit exceeded5.018s1532 KiB
5Time limit exceeded5.045s1680 KiB
6Time limit exceeded5.038s1824 KiB
7Time limit exceeded5.014s2016 KiB
8Time limit exceeded5.019s2168 KiB
9Time limit exceeded5.035s2164 KiB
subtask40/20
10Time limit exceeded5.046s2292 KiB
11Time limit exceeded5.03s2428 KiB
12Time limit exceeded5.034s2388 KiB
13Time limit exceeded5.057s2684 KiB
subtask50/40
14Time limit exceeded5.039s2744 KiB
15Time limit exceeded5.041s2664 KiB
16Time limit exceeded5.001s3144 KiB
17Time limit exceeded5.039s3076 KiB
18Time limit exceeded5.068s2884 KiB
19Time limit exceeded5.001s2768 KiB
20Accepted2.061s3912 KiB
21Time limit exceeded5.067s2876 KiB