QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#19448#1813. Joy with PermutationsYaoBIG#AC ✓1118ms4068kbC++174.1kb2022-01-31 05:20:282022-05-06 05:22:58

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-06 05:22:58]
  • 评测
  • 测评结果:AC
  • 用时:1118ms
  • 内存:4068kb
  • [2022-01-31 05:20:28]
  • 提交

answer

#include "bits/stdc++.h"
#define rep(i,a,n) for(auto i=a;i<=n;i++)
#define per(i,a,n) for(auto i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define FI first
#define SE second
#define all(A) A.begin(),A.end()
#define sz(A) (int)A.size()
template<class T> bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;}
using namespace std;

string to_string(const string& s) {return '"' + s + '"';}
string to_string(const char* s) {return to_string((string) s);}
template<typename A, typename B> string to_string(pair<A, B> p) {return "(" + to_string(p.FI) + ", " + to_string(p.SE) + ")";}
template<typename A> string to_string(A v) 
{
    bool first = 1;
    string res = "{";
    for(const auto &x: v) 
    {
        if (!first) res += ", ";
        first = 0;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() {cerr << endl;} 
template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) 
{
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifndef ONLINE_JUDGE
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) if(0) puts("No effect.")
#endif

using ll = long long;
//using LL = __int128;
using pii = pair<int,int>;
using vi = vector<int>;
using db = double;
using ldb = long double;

const int maxn = 60000;
const int mod = 998244353;
const int inf = 0x3f3f3f3f;

int v[maxn+5];

using si = set<int>;
int ask(si S)
{
    assert(sz(S)==3);
    printf("? 1");
    for(auto x: S) printf(" %d",x);
    puts("");
    fflush(stdout);
    int x; scanf("%d",&x);
    return x;
}
int smaller(int i,int j)
{
    printf("? 2 %d %d\n",i,j); fflush(stdout);
    int x; scanf("%d",&x);
    return x;
}
void output(int n)
{
    printf("!");
    rep(i,1,n) printf(" %d",v[i]);
    puts("");
    fflush(stdout);
}

si common(si a,si b)
{
    set<int> res;
    for(auto x: a) if(b.count(x)) res.insert(x);
    return res;
}

int main()
{
    int n; scanf("%d",&n);
    si A[4] = {};
    int tmp[4] = {};
    A[0] = si{1,2,3};
    A[1] = si{1,2,4};
    A[2] = si{1,3,4};
    A[3] = si{2,3,4};
    rep(i,0,2) tmp[i] = ask(A[i]), tmp[3] ^= tmp[i];
    int mx = -inf, mn = inf;
    rep(i,0,3) chmax(mx,tmp[i]), chmin(mn,tmp[i]);
    vector<si> sm,bg;
    rep(i,0,3) if(tmp[i]==mn) sm.pb(A[i]); else bg.pb(A[i]);
    assert(sz(sm)==2 && sz(bg)==2);
    auto S = common(sm[0],sm[1]);
    auto B = common(bg[0],bg[1]);
    rep(i,5,n)
    {
        assert(sz(S)==2);
        assert(sz(B)==2);
        int a = *S.begin(), b = *S.rbegin();
        int c = *B.begin(), d = *B.rbegin();
        int z = ask(si{a,c,i});
        // res can be mn/mx/new value (say z).
        if(z==mn)
        {
            // this means that v[i] < mn and v[a] = mn;
            v[a] = mn;
            mn = ask(si{a,b,i});
            S.erase(a);
            S.insert(i);
        } 
        else if(z==mx)
        {
            // this means that v[i] > mx and v[c] = mx;
            v[c] = mx;
            mx = ask(si{c,d,i});
            B.erase(c);
            B.insert(i);
        }
        else
        {
            // z can be in: (mn,mx) / (-inf,mn) / (mx,inf);
            if(mn<z && z<mx)
            {
                v[i] = z;
            }
            else if(z<mn)
            {
                // this means that v[b] = mn and replace mn = z.
                v[b] = mn;
                mn = z;
                S.erase(b);
                S.insert(i);
            }
            else 
            {
                // this means that v[d] = mx and replace mx = z.
                v[d] = mx;
                mx = z;
                B.erase(d);
                B.insert(i);
            }
        }
    }
    int a = *S.begin(), b = *S.rbegin();
    int c = *B.begin(), d = *B.rbegin();
    if(smaller(a,b)==a) v[a] = 1, v[b] = 2;
    else v[a] = 2, v[b] = 1;
    if(smaller(c,d)==c) v[c] = n-1, v[d] = n;
    else v[c] = n, v[d] = n-1;
    output(n);
    return 0;
}
// ! 3 5 4 1 2

详细

Test #1:

score: 100
Accepted
time: 4ms
memory: 3692kb

input:

5
4
3
3
3
2
4
3

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 2 5
? 1 1 4 5
? 2 4 5
? 2 2 3
! 3 5 4 1 2

result:

ok OK (5 2)

Test #2:

score: 0
Accepted
time: 1015ms
memory: 4020kb

input:

60000
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
18
19
19
20
20
21
21
22
22
23
23
24
24
25
25
26
26
27
27
28
28
29
29
30
30
31
31
32
32
33
33
34
34
35
35
36
36
37
37
38
38
39
39
40
40
41
41
42
42
43
43
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
5...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (119995 2)

Test #3:

score: 0
Accepted
time: 1118ms
memory: 4056kb

input:

60000
59999
59999
59998
59998
59997
59997
59996
59996
59995
59995
59994
59994
59993
59993
59992
59992
59991
59991
59990
59990
59989
59989
59988
59988
59987
59987
59986
59986
59985
59985
59984
59984
59983
59983
59982
59982
59981
59981
59980
59980
59979
59979
59978
59978
59977
59977
59976
59976
59975
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (119995 2)

Test #4:

score: 0
Accepted
time: 330ms
memory: 3788kb

input:

28238
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
18
19
19
20
20
21
21
22
22
23
23
24
24
25
25
26
26
27
27
28
28
29
29
30
30
31
31
32
32
33
33
34
34
35
35
36
36
37
37
38
38
39
39
40
40
41
41
42
42
43
43
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
5...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (56471 2)

Test #5:

score: 0
Accepted
time: 270ms
memory: 3896kb

input:

13205
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
18
19
19
20
20
21
21
22
22
23
23
24
24
25
25
26
26
27
27
28
28
29
29
30
30
31
31
32
32
33
33
34
34
35
35
36
36
37
37
38
38
39
39
40
40
41
41
42
42
43
43
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
5...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (26405 2)

Test #6:

score: 0
Accepted
time: 977ms
memory: 3968kb

input:

56108
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
18
19
19
20
20
21
21
22
22
23
23
24
24
25
25
26
26
27
27
28
28
29
29
30
30
31
31
32
32
33
33
34
34
35
35
36
36
37
37
38
38
39
39
40
40
41
41
42
42
43
43
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
5...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (112211 2)

Test #7:

score: 0
Accepted
time: 509ms
memory: 3880kb

input:

34446
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
18
19
19
20
20
21
21
22
22
23
23
24
24
25
25
26
26
27
27
28
28
29
29
30
30
31
31
32
32
33
33
34
34
35
35
36
36
37
37
38
38
39
39
40
40
41
41
42
42
43
43
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
5...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (68887 2)

Test #8:

score: 0
Accepted
time: 968ms
memory: 3884kb

input:

48565
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
18
19
19
20
20
21
21
22
22
23
23
24
24
25
25
26
26
27
27
28
28
29
29
30
30
31
31
32
32
33
33
34
34
35
35
36
36
37
37
38
38
39
39
40
40
41
41
42
42
43
43
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
5...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (97125 2)

Test #9:

score: 0
Accepted
time: 431ms
memory: 3792kb

input:

26055
26054
26054
26053
26053
26052
26052
26051
26051
26050
26050
26049
26049
26048
26048
26047
26047
26046
26046
26045
26045
26044
26044
26043
26043
26042
26042
26041
26041
26040
26040
26039
26039
26038
26038
26037
26037
26036
26036
26035
26035
26034
26034
26033
26033
26032
26032
26031
26031
26030
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (52105 2)

Test #10:

score: 0
Accepted
time: 596ms
memory: 3836kb

input:

35907
35906
35906
35905
35905
35904
35904
35903
35903
35902
35902
35901
35901
35900
35900
35899
35899
35898
35898
35897
35897
35896
35896
35895
35895
35894
35894
35893
35893
35892
35892
35891
35891
35890
35890
35889
35889
35888
35888
35887
35887
35886
35886
35885
35885
35884
35884
35883
35883
35882
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (71809 2)

Test #11:

score: 0
Accepted
time: 97ms
memory: 3872kb

input:

8640
8639
8639
8638
8638
8637
8637
8636
8636
8635
8635
8634
8634
8633
8633
8632
8632
8631
8631
8630
8630
8629
8629
8628
8628
8627
8627
8626
8626
8625
8625
8624
8624
8623
8623
8622
8622
8621
8621
8620
8620
8619
8619
8618
8618
8617
8617
8616
8616
8615
8615
8614
8614
8613
8613
8612
8612
8611
8611
8610
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (17275 2)

Test #12:

score: 0
Accepted
time: 554ms
memory: 3856kb

input:

27481
27480
27480
27479
27479
27478
27478
27477
27477
27476
27476
27475
27475
27474
27474
27473
27473
27472
27472
27471
27471
27470
27470
27469
27469
27468
27468
27467
27467
27466
27466
27465
27465
27464
27464
27463
27463
27462
27462
27461
27461
27460
27460
27459
27459
27458
27458
27457
27457
27456
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (54957 2)

Test #13:

score: 0
Accepted
time: 583ms
memory: 3944kb

input:

30992
30991
30991
30990
30990
30989
30989
30988
30988
30987
30987
30986
30986
30985
30985
30984
30984
30983
30983
30982
30982
30981
30981
30980
30980
30979
30979
30978
30978
30977
30977
30976
30976
30975
30975
30974
30974
30973
30973
30972
30972
30971
30971
30970
30970
30969
30969
30968
30968
30967
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (61979 2)

Test #14:

score: 0
Accepted
time: 950ms
memory: 4020kb

input:

60000
29402
29402
29401
29402
29403
29401
29400
29400
29399
29403
29404
29404
29405
29399
29398
29405
29406
29406
29407
29407
29408
29398
29397
29397
29396
29408
29409
29409
29410
29410
29411
29396
29395
29411
29412
29412
29413
29395
29394
29394
29393
29413
29414
29393
29392
29392
29391
29391
29390
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 1 2 5
? 1 2 3 6
? 1 3 4 6
? 1 2 4 7
? 1 4 6 7
? 1 2 6 8
? 1 2 5 8
? 1 5 6 9
? 1 5 8 9
? 1 6 8 10
? 1 6 7 10
? 1 7 8 11
? 1 8 9 11
? 1 7 9 12
? 1 9 11 12
? 1 7 11 13
? 1 11 12 13
? 1 7 12 14
? 1 7 10 14
? 1 10 12 15
? 1 10 14 15
? 1 12 14 16
? 1 12 13 16
? ...

result:

ok OK (119995 2)

Test #15:

score: 0
Accepted
time: 929ms
memory: 3952kb

input:

60000
55059
55059
55058
55058
55057
55057
55056
55056
55055
55055
55054
55054
55053
55053
55052
55052
55051
55051
55050
55050
55049
55049
55048
55048
55047
55047
55046
55046
55045
55045
55044
55044
55043
55043
55042
55042
55041
55041
55040
55040
55039
55039
55038
55038
55037
55037
55036
55036
55035
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (119994 2)

Test #16:

score: 0
Accepted
time: 891ms
memory: 4020kb

input:

60000
33839
33839
33838
33839
33840
33838
33837
33837
33836
33840
33841
33841
33842
33836
33835
33842
33843
33843
33844
33844
33845
33835
33834
33834
33833
33845
33846
33846
33847
33847
33848
33833
33832
33848
33849
33849
33850
33832
33831
33831
33830
33850
33851
33830
33829
33829
33828
33828
33827
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 1 2 5
? 1 2 3 6
? 1 3 4 6
? 1 2 4 7
? 1 4 6 7
? 1 2 6 8
? 1 2 5 8
? 1 5 6 9
? 1 5 8 9
? 1 6 8 10
? 1 6 7 10
? 1 7 8 11
? 1 8 9 11
? 1 7 9 12
? 1 9 11 12
? 1 7 11 13
? 1 11 12 13
? 1 7 12 14
? 1 7 10 14
? 1 10 12 15
? 1 10 14 15
? 1 12 14 16
? 1 12 13 16
? ...

result:

ok OK (119995 2)

Test #17:

score: 0
Accepted
time: 1044ms
memory: 4060kb

input:

60000
3659
3659
3660
3660
3661
3661
3662
3662
3663
3663
3664
3664
3665
3665
3666
3666
3667
3667
3668
3668
3669
3669
3670
3670
3671
3671
3672
3672
3673
3673
3674
3674
3675
3675
3676
3676
3677
3677
3678
3658
3678
3679
3679
3680
3680
3681
3681
3682
3682
3683
3683
3684
3684
3685
3658
3657
3657
3656
3685...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (119994 2)

Test #18:

score: 0
Accepted
time: 1118ms
memory: 4060kb

input:

60000
34725
34725
34724
34725
34726
34724
34723
34723
34722
34726
34727
34727
34728
34722
34721
34728
34729
34729
34730
34730
34731
34721
34720
34720
34719
34731
34732
34732
34733
34733
34734
34719
34718
34734
34735
34735
34736
34718
34717
34717
34716
34736
34737
34716
34715
34715
34714
34714
34713
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 1 2 5
? 1 2 3 6
? 1 3 4 6
? 1 2 4 7
? 1 4 6 7
? 1 2 6 8
? 1 2 5 8
? 1 5 6 9
? 1 5 8 9
? 1 6 8 10
? 1 6 7 10
? 1 7 8 11
? 1 8 9 11
? 1 7 9 12
? 1 9 11 12
? 1 7 11 13
? 1 11 12 13
? 1 7 12 14
? 1 7 10 14
? 1 10 12 15
? 1 10 14 15
? 1 12 14 16
? 1 12 13 16
? ...

result:

ok OK (119995 2)

Test #19:

score: 0
Accepted
time: 261ms
memory: 3812kb

input:

17163
15198
15198
15197
15197
15196
15196
15195
15195
15194
15194
15193
15193
15192
15192
15191
15191
15190
15190
15189
15189
15188
15188
15187
15199
15187
15186
15199
15200
15186
15185
15185
15184
15184
15183
15183
15182
15182
15181
15181
15180
15200
15201
15180
15179
15179
15178
15201
15202
15178
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 1 13 16
? 1 13 14 16
? 1 1 14 17
?...

result:

ok OK (34320 2)

Test #20:

score: 0
Accepted
time: 115ms
memory: 3708kb

input:

4466
1381
1381
1382
1382
1383
1383
1384
1384
1385
1385
1386
1381
1380
1386
1387
1387
1388
1388
1389
1389
1390
1380
1379
1379
1378
1390
1391
1378
1377
1391
1392
1392
1393
1393
1394
1377
1376
1376
1375
1394
1395
1395
1396
1375
1374
1396
1397
1397
1398
1374
1373
1373
1372
1372
1371
1371
1370
1398
1399
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 1 2 9
? 1 2 7 10
? 1 7 8 10
? 1 2 8 11
? 1 8 10 11
? 1 2 10 12
? 1 10 11 12
? 1 2 11 13
? 1 11 12 13
? 1 2 12 14
? 1 2 9 14
? 1 9 12 15
? 1 9 14 15
? 1 12 14 16
? 1 12 13 16
? ...

result:

ok OK (8927 2)

Test #21:

score: 0
Accepted
time: 1044ms
memory: 3952kb

input:

55052
39660
39659
39660
39659
39658
39658
39657
39660
39661
39657
39656
39661
39662
39656
39655
39655
39654
39654
39653
39653
39652
39652
39651
39662
39663
39651
39650
39650
39649
39663
39664
39649
39648
39648
39647
39647
39646
39646
39645
39645
39644
39664
39665
39644
39643
39643
39642
39642
39641
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 2 5
? 1 2 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 1 3 7
? 1 3 5 8
? 1 5 6 8
? 1 3 6 9
? 1 3 7 9
? 1 6 7 10
? 1 6 8 10
? 1 7 8 11
? 1 8 10 11
? 1 7 10 12
? 1 10 11 12
? 1 7 11 13
? 1 11 12 13
? 1 7 12 14
? 1 12 13 14
? 1 7 13 15
? 1 7 9 15
? 1 9 13 16
? 1 13 14 16
? ...

result:

ok OK (110099 2)

Test #22:

score: 0
Accepted
time: 690ms
memory: 3932kb

input:

47404
44535
44535
44534
44534
44533
44533
44532
44532
44531
44531
44530
44530
44529
44529
44528
44528
44527
44527
44526
44526
44525
44525
44524
44524
44523
44523
44522
44536
44522
44521
44521
44520
44520
44519
44519
44518
44518
44517
44517
44516
44516
44515
44515
44514
44514
44513
44513
44512
44536
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (94802 2)

Test #23:

score: 0
Accepted
time: 458ms
memory: 3784kb

input:

25675
20972
20972
20971
20973
20971
20970
20970
20969
20969
20968
20968
20967
20973
20974
20967
20966
20974
20975
20966
20965
20965
20964
20975
20976
20964
20963
20963
20962
20962
20961
20961
20960
20960
20959
20976
20977
20959
20958
20958
20957
20957
20956
20956
20955
20977
20978
20955
20954
20954
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 1 3 6
? 1 3 4 6
? 1 1 4 7
? 1 4 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 1 5 10
? 1 5 8 11
? 1 8 9 11
? 1 5 9 12
? 1 5 10 12
? 1 9 10 13
? 1 9 11 13
? 1 10 11 14
? 1 11 13 14
? 1 10 13 15
? 1 10 12 15
? 1 12 13 16
? 1 13 14 16
? 1 12 14 1...

result:

ok OK (51344 2)

Test #24:

score: 0
Accepted
time: 1094ms
memory: 4020kb

input:

60000
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
18
19
19
20
20
21
21
22
22
23
23
24
24
25
25
26
26
27
27
28
28
29
29
30
30
31
31
32
32
33
33
34
34
35
35
36
36
37
37
38
38
39
39
40
40
41
41
42
42
43
43
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
5...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (119995 2)

Test #25:

score: 0
Accepted
time: 1086ms
memory: 3976kb

input:

60000
59999
59999
59998
59998
59997
59997
59996
59996
59995
59995
59994
59994
59993
59993
59992
59992
59991
59991
59990
59990
59989
59989
59988
59988
59987
59987
59986
59986
59985
59985
59984
59984
59983
59983
59982
59982
59981
59981
59980
59980
59979
59979
59978
59978
59977
59977
59976
59976
59975
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (119995 2)

Test #26:

score: 0
Accepted
time: 505ms
memory: 3956kb

input:

60000
1541
42076
1541
39281
8931
18362
7490
42076
46053
46053
55693
56856
40927
25723
19443
11530
45917
16176
9249
10521
19203
55664
43588
46306
47069
48346
7387
42663
52170
33175
55980
26591
37480
33124
45305
20551
5485
47611
51667
50424
2730
10146
4392
13059
41041
49370
7061
18944
44120
1689
37511...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 2 5
? 1 1 2 6
? 1 1 2 7
? 1 1 2 8
? 1 1 2 9
? 1 2 4 9
? 1 1 4 10
? 1 4 9 10
? 1 1 9 11
? 1 1 9 12
? 1 1 9 13
? 1 1 9 14
? 1 1 9 15
? 1 1 9 16
? 1 1 9 17
? 1 1 9 18
? 1 1 9 19
? 1 1 9 20
? 1 1 9 21
? 1 1 9 22
? 1 1 9 23
? 1 1 9 24
? 1 1 9 25
? 1 1 9 26
? 1 1 9 27
?...

result:

ok OK (60017 2)

Test #27:

score: 0
Accepted
time: 514ms
memory: 4068kb

input:

60000
54925
32704
54925
54423
25061
15230
6566
12691
6566
5078
6140
53254
49554
36535
36631
51651
17314
16028
36913
20140
48472
45344
14763
41312
30847
4897
46097
39503
27619
56105
18544
28240
28359
53469
41205
18963
11665
44484
4497
4497
2095
26328
19497
57237
55934
7140
23992
22413
11018
2095
1428...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 2 5
? 1 1 2 6
? 1 1 2 7
? 1 1 2 8
? 1 1 2 9
? 1 1 2 10
? 1 2 8 10
? 1 1 8 11
? 1 1 8 12
? 1 1 8 13
? 1 1 8 14
? 1 1 8 15
? 1 1 8 16
? 1 1 8 17
? 1 1 8 18
? 1 1 8 19
? 1 1 8 20
? 1 1 8 21
? 1 1 8 22
? 1 1 8 23
? 1 1 8 24
? 1 1 8 25
? 1 1 8 26
? 1 1 8 27
? 1 1 8 28
...

result:

ok OK (60015 2)

Test #28:

score: 0
Accepted
time: 439ms
memory: 4052kb

input:

60000
43456
30892
30892
31456
30892
27124
27124
3380
42679
41389
43973
43973
55835
36772
55772
23628
4442
26473
19627
28204
39034
55835
56072
1477
4363
28410
23877
23219
34971
40800
41024
46171
45698
43348
56072
57052
48690
52575
7830
45142
54109
42205
41086
40093
40854
56162
6978
1477
1316
45486
23...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 2 5
? 1 1 2 6
? 1 1 4 6
? 1 2 4 7
? 1 4 6 7
? 1 2 6 8
? 1 2 6 9
? 1 2 6 10
? 1 2 6 11
? 1 2 10 11
? 1 6 10 12
? 1 6 10 13
? 1 6 10 14
? 1 6 10 15
? 1 6 10 16
? 1 6 10 17
? 1 6 10 18
? 1 6 10 19
? 1 6 10 20
? 1 10 11 20
? 1 6 11 21
? 1 6 11 22
? 1 6 11 23
? 1 6 11 ...

result:

ok OK (60017 2)

Test #29:

score: 0
Accepted
time: 559ms
memory: 4052kb

input:

60000
20459
20459
26661
26661
32741
35013
20459
10822
14164
10822
9286
35013
49251
9906
43100
44085
54863
23709
33329
23595
39507
43074
55459
49205
40413
11284
24791
18726
23510
29720
30081
12382
19610
12538
7340
22308
10791
44730
55788
7340
4091
42147
21954
32485
20811
51113
16360
25869
15859
29831...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 1 4 7
? 1 1 2 7
? 1 2 4 8
? 1 2 4 9
? 1 2 7 9
? 1 4 7 10
? 1 4 6 10
? 1 6 7 11
? 1 6 7 12
? 1 6 7 13
? 1 6 7 14
? 1 6 7 15
? 1 6 7 16
? 1 6 7 17
? 1 6 7 18
? 1 6 7 19
? 1 6 7 20
? 1 6 7 21
? 1 6 7 22
? 1 6 7 23
? 1 6 7 24
? 1 6 7 25
? 1...

result:

ok OK (60021 2)

Test #30:

score: 0
Accepted
time: 501ms
memory: 3924kb

input:

60000
41840
15755
41840
34684
14125
27521
35786
39111
21664
41840
42338
24322
42338
44846
44846
45018
44047
39489
42258
44365
45018
46527
12825
20959
46527
56429
36853
30480
32744
51984
59011
45471
55305
6870
49387
8483
49310
36796
52368
40008
34809
10951
35107
4911
15799
57410
41391
51125
23836
189...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 2 5
? 1 1 2 6
? 1 1 2 7
? 1 1 2 8
? 1 1 2 9
? 1 1 2 10
? 1 1 2 11
? 1 1 3 11
? 1 2 3 12
? 1 2 3 13
? 1 3 11 13
? 1 2 11 14
? 1 11 13 14
? 1 2 13 15
? 1 2 13 16
? 1 2 13 17
? 1 2 13 18
? 1 2 13 19
? 1 13 14 19
? 1 2 14 20
? 1 2 14 21
? 1 2 14 22
? 1 14 19 22
? 1 2 ...

result:

ok OK (60024 2)

Test #31:

score: 0
Accepted
time: 553ms
memory: 3928kb

input:

60000
22013
12950
22013
20003
13898
22013
31027
29532
31027
40607
34950
7706
42942
42942
49061
26324
20009
24521
53105
12385
17055
7706
6306
5100
21723
44283
4237
20786
52651
19766
34800
35835
43711
12703
23900
46174
27040
2409
53380
34467
53380
57219
6863
26652
54603
31700
38226
50447
29867
20171
3...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 2 5
? 1 1 2 6
? 1 1 2 7
? 1 1 3 7
? 1 2 3 8
? 1 2 3 9
? 1 3 7 9
? 1 2 7 10
? 1 2 7 11
? 1 2 7 12
? 1 2 7 13
? 1 7 12 13
? 1 2 12 14
? 1 2 12 15
? 1 2 12 16
? 1 2 12 17
? 1 2 12 18
? 1 2 12 19
? 1 2 12 20
? 1 2 11 20
? 1 11 12 21
? 1 11 12 22
? 1 11 12 23
? 1 11 12...

result:

ok OK (60016 2)

Test #32:

score: 0
Accepted
time: 463ms
memory: 3980kb

input:

60000
22627
28868
28868
49873
49873
51429
56861
56700
55566
51177
36397
5564
30560
56753
42939
49202
10759
33789
51431
33363
56487
33135
5564
4554
27715
4554
4221
24016
28084
7367
56861
57306
33630
4221
3843
37978
18598
56992
17128
44592
17433
49670
49740
44302
52558
57306
57621
57080
28647
34954
33...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 2 5
? 1 1 2 6
? 1 1 5 6
? 1 2 5 7
? 1 2 5 8
? 1 2 5 9
? 1 2 5 10
? 1 2 5 11
? 1 2 5 12
? 1 2 5 13
? 1 2 5 14
? 1 2 5 15
? 1 2 5 16
? 1 2 5 17
? 1 2 5 18
? 1 2 5 19
? 1 2 5 20
? 1 2 5 21
? 1 2 5 22
? 1 2 5 23
? 1 2 12 23
? 1 5 12 24
? 1 5 12 25
? 1 12 23 25
? 1 5 2...

result:

ok OK (60025 2)

Test #33:

score: 0
Accepted
time: 523ms
memory: 4032kb

input:

60000
40813
40813
54175
40813
39739
55092
55647
39739
29874
29874
9390
28074
9390
9160
54834
15719
54469
40170
16403
11716
51871
7324
28758
48727
12504
40886
7324
5010
10755
10360
5010
3945
37955
5176
23710
3945
1542
32998
31029
30399
15794
57320
45518
5258
40757
11349
35176
14565
30773
33808
54064
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 1 2 5
? 1 2 3 6
? 1 2 3 7
? 1 2 3 8
? 1 2 5 8
? 1 3 5 9
? 1 5 8 9
? 1 3 8 10
? 1 3 8 11
? 1 8 9 11
? 1 3 9 12
? 1 3 9 13
? 1 3 9 14
? 1 3 9 15
? 1 3 9 16
? 1 3 9 17
? 1 3 9 18
? 1 3 9 19
? 1 3 9 20
? 1 3 9 21
? 1 3 9 22
? 1 3 9 23
? 1 3 9 24
? 1 9 19 24
? ...

result:

ok OK (60019 2)

Test #34:

score: 0
Accepted
time: 525ms
memory: 3792kb

input:

25186
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
18
19
19
20
20
21
21
22
22
23
23
24
24
25
25
26
26
27
27
28
28
29
29
30
30
31
31
32
32
33
33
34
34
35
35
36
36
37
37
38
38
39
39
40
40
41
41
42
42
43
43
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
5...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (50367 2)

Test #35:

score: 0
Accepted
time: 518ms
memory: 3880kb

input:

35278
35277
35277
35276
35276
35275
35275
35274
35274
35273
35273
35272
35272
35271
35271
35270
35270
35269
35269
35268
35268
35267
35267
35266
35266
35265
35265
35264
35264
35263
35263
35262
35262
35261
35261
35260
35260
35259
35259
35258
35258
35257
35257
35256
35256
35255
35255
35254
35254
35253
...

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 1 1 3 5
? 1 3 4 5
? 1 1 4 6
? 1 4 5 6
? 1 1 5 7
? 1 5 6 7
? 1 1 6 8
? 1 6 7 8
? 1 1 7 9
? 1 7 8 9
? 1 1 8 10
? 1 8 9 10
? 1 1 9 11
? 1 9 10 11
? 1 1 10 12
? 1 10 11 12
? 1 1 11 13
? 1 11 12 13
? 1 1 12 14
? 1 12 13 14
? 1 1 13 15
? 1 13 14 15
? 1 1 14 16
? 1 14 15 16
...

result:

ok OK (70551 2)

Test #36:

score: 0
Accepted
time: 4ms
memory: 3748kb

input:

4
2
3
3
3
4

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 2 2 3
? 2 1 4
! 4 2 1 3

result:

ok OK (3 2)

Test #37:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

4
2
3
3
2
4

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 2 2 3
? 2 1 4
! 4 1 2 3

result:

ok OK (3 2)

Test #38:

score: 0
Accepted
time: 4ms
memory: 3840kb

input:

4
2
3
3
2
1

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 2 2 3
? 2 1 4
! 3 1 2 4

result:

ok OK (3 2)

Test #39:

score: 0
Accepted
time: 4ms
memory: 3708kb

input:

4
3
3
2
3
1

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 2 3 4
? 2 1 2
! 3 4 1 2

result:

ok OK (3 2)

Test #40:

score: 0
Accepted
time: 4ms
memory: 3784kb

input:

4
2
2
3
2
4

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 2 1 2
? 2 3 4
! 2 1 4 3

result:

ok OK (3 2)

Test #41:

score: 0
Accepted
time: 1ms
memory: 3840kb

input:

4
2
2
3
1
4

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 2 1 2
? 2 3 4
! 1 2 4 3

result:

ok OK (3 2)

Test #42:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

4
3
2
3
2
1

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 2 2 4
? 2 1 3
! 3 1 4 2

result:

ok OK (3 2)

Test #43:

score: 0
Accepted
time: 4ms
memory: 3824kb

input:

4
2
3
3
3
1

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 2 2 3
? 2 1 4
! 3 2 1 4

result:

ok OK (3 2)

Test #44:

score: 0
Accepted
time: 3ms
memory: 3788kb

input:

4
2
2
3
1
3

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 2 1 2
? 2 3 4
! 1 2 3 4

result:

ok OK (3 2)

Test #45:

score: 0
Accepted
time: 2ms
memory: 3836kb

input:

4
3
3
2
4
2

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 2 3 4
? 2 1 2
! 4 3 2 1

result:

ok OK (3 2)

Test #46:

score: 0
Accepted
time: 4ms
memory: 3696kb

input:

4
3
2
2
4
2

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 2 1 4
? 2 2 3
! 2 3 4 1

result:

ok OK (3 2)

Test #47:

score: 0
Accepted
time: 4ms
memory: 3896kb

input:

4
3
2
3
2
3

output:

? 1 1 2 3
? 1 1 2 4
? 1 1 3 4
? 2 2 4
? 2 1 3
! 4 1 3 2

result:

ok OK (3 2)