QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#780164#1813. Joy with PermutationsandrewgopherAC ✓286ms7568kbC++143.8kb2024-11-25 03:01:082024-11-25 03:01:10

Judging History

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

  • [2024-11-25 03:01:10]
  • 评测
  • 测评结果:AC
  • 用时:286ms
  • 内存:7568kb
  • [2024-11-25 03:01:08]
  • 提交

answer

#include "bits/stdc++.h"
using namespace std;
//#define fast ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0)
#define int long long

int med(int i,int j,int k){
    cout << "? 1 " << i << " " << j << " " << k << endl;
    int ans;cin>>ans;
    return ans;
}

bool lt(int i,int j){
    cout << "? 2 " << i << " " << j << endl;
    int ans;cin>>ans;
    return ans==i;
}

void solve() {
    int n;
    cin >> n;

    //initialize

    set<pair<int,int>> cur;

    {
        int qa = med(1,2,3);
        int qb = med(1,2,4);
        int qc = med(1,3,4);
        int qd = med(2,3,4);

        if (qa == qb){
            if (qa < qc){
                cur = {{qa,1},{qa,2},{qc,3},{qc,4}};
            } else {
                cur={{qc,3},{qc,4},{qa,1},{qa,2}};
            }
        } else if (qa == qc){
            if (qa < qb){
                cur={{qa,1},{qa,3},{qb,2},{qb,4}};
            } else {
                cur={{qb,2},{qb,4},{qa,1},{qa,3}};
            }
        } else if (qa==qd){
            if (qa < qb){
                cur={{qa,2},{qa,3},{qb,1},{qb,4}};
            } else {
                cur={{qb,1},{qb,4},{qa,2},{qa,3}};
            }
        }
    }

    for (int i = 5;i<=n;i++){
        //query higher
        
        auto curBack = *cur.rbegin();
        auto curSecBackIt = cur.rbegin();
        curSecBackIt--;
        auto curSecBack = *curSecBackIt;

        auto curFront = *cur.begin();
        auto curSecFrontIt = cur.begin();
        curSecFrontIt++;
        auto curSecFront = *curSecFrontIt;

        int secMin = curFront.first;
        int secMax = curBack.first;

        int ql = med(curFront.second, curSecBack.second,i);
        int qh = med(curSecFront.second, curBack.second,i);

        if (ql < secMin){
            //update curFront to have value ql, insert i with value ql
            cur.erase(curFront);
            cur.insert({ql,curFront.second});
            cur.insert({ql,i});
        } else if (ql == secMin) {
            //update curSecFront to have value qh, insert i with value qh
            cur.erase(curSecFront);
            cur.insert({qh,curSecFront.second});
            cur.insert({qh,i});
        } else if (ql > secMin && ql < secMax) {
            //insert i with value ql
            cur.insert({ql,i});
        } else if (ql == secMax) {
            //update curBack to have value qh, insert i with value qh
            cur.erase(curBack);
            cur.insert({qh,curBack.second});
            cur.insert({qh,i});
        } else if (ql>secMax) {
            //update curSecBack to have value ql, insert i with value ql
            cur.erase(curSecBack);
            cur.insert({ql,curSecBack.second});
            cur.insert({ql,i});
        } else {
            assert("oops wtf");
        }
    }

    {
    auto it = cur.begin();
        int frontInd = it->second;
        it++;
        int secFrontInd = it->second;

        if (lt(frontInd,secFrontInd)){
            cur.erase(cur.begin());
            cur.insert({1,frontInd});
        } else {
            cur.erase(it);
            cur.insert({1,secFrontInd});
        }
    }

    {
        auto it2 =cur.rbegin();
        int backInd = it2->second;
        it2--;
        int secBackInd = it2->second;
        if (lt(backInd,secBackInd)){
            cur.erase({it2->first,secBackInd});
            cur.insert({n,secBackInd});
        } else {
            cur.erase({cur.rbegin()->first,backInd});
            cur.insert({n,backInd});
        }
    }

    vector<int> ans(n);
    for (auto p : cur){
        ans[p.second-1]=p.first;
    }
    cout << "! ";
    for (int i =0;i<n;i++){
        cout << ans[i] << " ";
    }
    cout << endl;
}

signed main() {
    int t=1;
    while (t--) solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3612kb

input:

5
4
3
3
4
3
2
4
3

output:

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

result:

ok OK (6 2)

Test #2:

score: 0
Accepted
time: 231ms
memory: 7568kb

input:

60000
2
2
3
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...

output:

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

result:

ok OK (119996 2)

Test #3:

score: 0
Accepted
time: 242ms
memory: 7368kb

input:

60000
59999
59999
59998
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
...

output:

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

result:

ok OK (119996 2)

Test #4:

score: 0
Accepted
time: 113ms
memory: 5580kb

input:

28238
2
2
3
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...

output:

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

result:

ok OK (56472 2)

Test #5:

score: 0
Accepted
time: 63ms
memory: 4380kb

input:

13205
2
2
3
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...

output:

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

result:

ok OK (26406 2)

Test #6:

score: 0
Accepted
time: 234ms
memory: 7276kb

input:

56108
2
2
3
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...

output:

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

result:

ok OK (112212 2)

Test #7:

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

input:

34446
2
2
3
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...

output:

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

result:

ok OK (68888 2)

Test #8:

score: 0
Accepted
time: 180ms
memory: 6840kb

input:

48565
2
2
3
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...

output:

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

result:

ok OK (97126 2)

Test #9:

score: 0
Accepted
time: 65ms
memory: 5432kb

input:

26055
26054
26054
26053
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
...

output:

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

result:

ok OK (52106 2)

Test #10:

score: 0
Accepted
time: 165ms
memory: 6044kb

input:

35907
35906
35906
35905
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
...

output:

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

result:

ok OK (71810 2)

Test #11:

score: 0
Accepted
time: 43ms
memory: 4188kb

input:

8640
8639
8639
8638
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
...

output:

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

result:

ok OK (17276 2)

Test #12:

score: 0
Accepted
time: 94ms
memory: 5300kb

input:

27481
27480
27480
27479
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
...

output:

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

result:

ok OK (54958 2)

Test #13:

score: 0
Accepted
time: 111ms
memory: 5740kb

input:

30992
30991
30991
30990
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
...

output:

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

result:

ok OK (61980 2)

Test #14:

score: 0
Accepted
time: 283ms
memory: 7548kb

input:

60000
29402
29402
29401
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
...

output:

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

result:

ok OK (119996 2)

Test #15:

score: 0
Accepted
time: 189ms
memory: 7556kb

input:

60000
55059
55059
55058
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
...

output:

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

result:

ok OK (119996 2)

Test #16:

score: 0
Accepted
time: 210ms
memory: 7364kb

input:

60000
33839
33839
33838
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
...

output:

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

result:

ok OK (119996 2)

Test #17:

score: 0
Accepted
time: 166ms
memory: 7332kb

input:

60000
3659
3659
3660
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
3659
3678
3679
3679
3680
3680
3681
3681
3682
3682
3683
3683
3684
3684
3685
3658
3657
3657...

output:

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

result:

ok OK (119996 2)

Test #18:

score: 0
Accepted
time: 286ms
memory: 7332kb

input:

60000
34725
34725
34724
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
...

output:

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

result:

ok OK (119996 2)

Test #19:

score: 0
Accepted
time: 55ms
memory: 4672kb

input:

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

output:

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

result:

ok OK (34322 2)

Test #20:

score: 0
Accepted
time: 16ms
memory: 3852kb

input:

4466
1381
1381
1382
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
...

output:

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

result:

ok OK (8928 2)

Test #21:

score: 0
Accepted
time: 149ms
memory: 7004kb

input:

55052
39660
39659
39660
39659
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
...

output:

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

result:

ok OK (110100 2)

Test #22:

score: 0
Accepted
time: 142ms
memory: 6568kb

input:

47404
44535
44535
44534
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
44535
44522
44521
44521
44520
44520
44519
44519
44518
44518
44517
44517
44516
44516
44515
44515
44514
44514
44513
44513
...

output:

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

result:

ok OK (94804 2)

Test #23:

score: 0
Accepted
time: 102ms
memory: 5204kb

input:

25675
20972
20972
20971
20971
20973
20972
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
...

output:

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

result:

ok OK (51346 2)

Test #24:

score: 0
Accepted
time: 248ms
memory: 7332kb

input:

60000
2
2
3
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...

output:

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

result:

ok OK (119996 2)

Test #25:

score: 0
Accepted
time: 217ms
memory: 7312kb

input:

60000
59999
59999
59998
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
...

output:

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

result:

ok OK (119996 2)

Test #26:

score: 0
Accepted
time: 276ms
memory: 7548kb

input:

60000
1541
42076
1541
42076
39281
39281
8931
8931
18362
18362
7490
7490
42076
46053
46053
55693
56856
55693
40927
40927
25723
25723
19443
19443
11530
11530
45917
45917
16176
16176
9249
9249
10521
10521
19203
19203
55664
55664
43588
43588
46306
46306
47069
47069
48346
48346
7387
7387
42663
42663
5217...

output:

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

result:

ok OK (119996 2)

Test #27:

score: 0
Accepted
time: 276ms
memory: 7492kb

input:

60000
54925
32704
54925
32704
54423
54423
25061
32704
15230
25061
6566
15230
12691
12691
6566
5078
6140
6140
53254
53254
49554
49554
36535
36535
36631
36631
51651
51651
17314
17314
16028
16028
36913
36913
20140
20140
48472
48472
45344
45344
14763
14763
41312
41312
30847
30847
4897
5078
46097
46097
3...

output:

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

result:

ok OK (119996 2)

Test #28:

score: 0
Accepted
time: 219ms
memory: 7364kb

input:

60000
43456
30892
30892
43456
31456
31456
30892
27124
27124
3380
42679
42679
41389
41389
43973
43456
43973
55835
36772
36772
55772
55772
23628
23628
4442
4442
26473
26473
19627
19627
28204
28204
39034
39034
55835
56072
1477
3380
4363
4363
28410
28410
23877
23877
23219
23219
34971
34971
40800
40800
4...

output:

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

result:

ok OK (119996 2)

Test #29:

score: 0
Accepted
time: 254ms
memory: 7332kb

input:

60000
20459
20459
26661
26661
26661
32741
35013
32741
20459
10822
14164
14164
10822
9286
35013
49251
9906
9906
43100
43100
44085
44085
54863
49251
23709
23709
33329
33329
23595
23595
39507
39507
43074
43074
55459
54863
49205
49205
40413
40413
11284
11284
24791
24791
18726
18726
23510
23510
29720
297...

output:

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

result:

ok OK (119996 2)

Test #30:

score: 0
Accepted
time: 265ms
memory: 7392kb

input:

60000
41840
15755
41840
15755
34684
34684
14125
15755
27521
27521
35786
35786
39111
39111
21664
21664
41840
42338
24322
24322
42338
44846
44846
45018
44047
44047
39489
39489
42258
42258
44365
44365
45018
46527
12825
14125
20959
20959
46527
56429
36853
36853
30480
30480
32744
32744
51984
51984
59011
...

output:

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

result:

ok OK (119996 2)

Test #31:

score: 0
Accepted
time: 223ms
memory: 7336kb

input:

60000
22013
12950
22013
12950
20003
20003
13898
13898
22013
31027
29532
29532
31027
40607
34950
34950
7706
12950
42942
40607
42942
49061
26324
26324
20009
20009
24521
24521
53105
49061
12385
12385
17055
17055
7706
6306
5100
6306
21723
21723
44283
44283
4237
5100
20786
20786
52651
52651
19766
19766
3...

output:

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

result:

ok OK (119996 2)

Test #32:

score: 0
Accepted
time: 186ms
memory: 7564kb

input:

60000
22627
28868
28868
22627
49873
28868
49873
51429
56861
51429
56700
56700
55566
55566
51177
51177
36397
36397
5564
22627
30560
30560
56753
56753
42939
42939
49202
49202
10759
10759
33789
33789
51431
51431
33363
33363
56487
56487
33135
33135
5564
4554
27715
27715
4554
4221
24016
24016
28084
28084...

output:

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

result:

ok OK (119996 2)

Test #33:

score: 0
Accepted
time: 247ms
memory: 7396kb

input:

60000
40813
40813
54175
54175
40813
39739
55092
54175
55647
55092
39739
29874
29874
9390
28074
28074
9390
9160
54834
54834
15719
15719
54469
54469
40170
40170
16403
16403
11716
11716
51871
51871
7324
9160
28758
28758
48727
48727
12504
12504
40886
40886
7324
5010
10755
10755
10360
10360
5010
3945
379...

output:

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

result:

ok OK (119996 2)

Test #34:

score: 0
Accepted
time: 73ms
memory: 5116kb

input:

25186
2
2
3
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...

output:

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

result:

ok OK (50368 2)

Test #35:

score: 0
Accepted
time: 137ms
memory: 5780kb

input:

35278
35277
35277
35276
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
...

output:

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

result:

ok OK (70552 2)

Test #36:

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

input:

4
2
3
3
2
3
4

output:

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

result:

ok OK (4 2)

Test #37:

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

input:

4
2
3
3
2
2
4

output:

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

result:

ok OK (4 2)

Test #38:

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

input:

4
2
3
3
2
2
1

output:

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

result:

ok OK (4 2)

Test #39:

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

input:

4
3
3
2
2
3
1

output:

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

result:

ok OK (4 2)

Test #40:

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

input:

4
2
2
3
3
2
4

output:

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

result:

ok OK (4 2)

Test #41:

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

input:

4
2
2
3
3
1
4

output:

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

result:

ok OK (4 2)

Test #42:

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

input:

4
3
2
3
2
2
1

output:

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

result:

ok OK (4 2)

Test #43:

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

input:

4
2
3
3
2
3
1

output:

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

result:

ok OK (4 2)

Test #44:

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

input:

4
2
2
3
3
1
3

output:

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

result:

ok OK (4 2)

Test #45:

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

input:

4
3
3
2
2
4
2

output:

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

result:

ok OK (4 2)

Test #46:

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

input:

4
3
2
2
3
4
2

output:

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

result:

ok OK (4 2)

Test #47:

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

input:

4
3
2
3
2
2
3

output:

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

result:

ok OK (4 2)