21332022-12-21 12:07:33TimiNomekopcpp11Time limit exceeded 0/1002.328s3756 KiB
#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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted4ms1744 KiB
subtask20/10
2Time limit exceeded12ms1300 KiB
3Time limit exceeded16ms1468 KiB
subtask30/30
4Time limit exceeded61ms1608 KiB
5Time limit exceeded239ms1828 KiB
6Time limit exceeded238ms2092 KiB
7Time limit exceeded239ms2212 KiB
8Time limit exceeded61ms2536 KiB
9Time limit exceeded239ms2652 KiB
subtask40/20
10Time limit exceeded474ms3032 KiB
11Time limit exceeded476ms3280 KiB
12Time limit exceeded476ms3040 KiB
13Time limit exceeded479ms3348 KiB
subtask50/40
14Time limit exceeded1.8s3412 KiB
15Time limit exceeded1.914s3512 KiB
16Time limit exceeded1.796s3448 KiB
17Time limit exceeded1.661s3352 KiB
18Time limit exceeded2.328s3280 KiB
19Time limit exceeded1.824s3392 KiB
20Time limit exceeded1.907s3392 KiB
21Time limit exceeded1.909s3756 KiB