QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#372901#5277. Limited SwapsFOY#AC ✓1ms3836kbC++141.8kb2024-03-31 20:31:262024-03-31 20:31:28

Judging History

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

  • [2024-03-31 20:31:28]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3836kb
  • [2024-03-31 20:31:26]
  • 提交

answer

#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>

using namespace std;
using vi = vector<int>;
using vpi = vector<pair<int, int>>;

int main() {
    int n; cin >> n;
    vi a(n);
    vi b(n);
    vi aplace(n+1);
    vi bplace(n+1);
    vpi shit;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        aplace[a[i]] = i;
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
        bplace[b[i]] = i;
        shit.push_back({i, b[i]});
    }
    // for (int i = 1; i <= n; i++) {
    //     cout << aplace[i] << ' ';
    // }
    // cout << endl;
    // for (int i = 1; i <= n; i++) {
    //     cout << bplace[i] << ' ';
    // }
    // cout << endl;
    sort(shit.begin(), shit.end(), greater<>());
    for (int i = 1; i < n; i++) {
        if (((aplace[i] - aplace[i+1])*(bplace[i] - bplace[i+1])) < 0) {
            // opposite order
            cout << -1 << endl;
            return 0;
        }
    }
    // can be done
    // what goes in last place?
    // just order by descending last position
    vi ans;
    for (int i = 0; i < n; i++) {
        int x = shit[i].second;
        int idx = 0;
        for (; idx < n; idx++) {
            if (a[idx] == x) break;
        }
        while (idx < bplace[x]) {
            ans.push_back(idx);
            assert(idx < n);
            assert(abs(a[idx] - a[idx+1]) >= 2);
            swap(a[idx], a[idx+1]);
            idx++;
        }
        while (idx > bplace[x]) {
            assert(idx > 0);
            assert(abs(a[idx] - a[idx-1]) >= 2);
            ans.push_back(idx-1);
            swap(a[idx], a[idx-1]);
            idx--;
        }

    }
    cout << ans.size() << endl;
    for (int x : ans) cout << x+1 << ' ';
    if (ans.size()) cout << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3616kb

input:

5
1 3 5 2 4
3 5 1 4 2

output:

3
4 1 2 

result:

ok OK, found solution, n = 5, ops = 3

Test #2:

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

input:

4
1 2 3 4
4 3 2 1

output:

-1

result:

ok OK, no solution

Test #3:

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

input:

1
1
1

output:

0

result:

ok OK, found solution, n = 1, ops = 0

Test #4:

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

input:

2
1 2
2 1

output:

-1

result:

ok OK, no solution

Test #5:

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

input:

2
1 2
1 2

output:

0

result:

ok OK, found solution, n = 2, ops = 0

Test #6:

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

input:

3
3 2 1
3 1 2

output:

-1

result:

ok OK, no solution

Test #7:

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

input:

3
1 2 3
1 2 3

output:

0

result:

ok OK, found solution, n = 3, ops = 0

Test #8:

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

input:

4
4 2 3 1
3 4 2 1

output:

-1

result:

ok OK, no solution

Test #9:

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

input:

4
3 2 4 1
3 2 1 4

output:

1
3 

result:

ok OK, found solution, n = 4, ops = 1

Test #10:

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

input:

5
4 3 2 1 5
4 1 5 2 3

output:

-1

result:

ok OK, no solution

Test #11:

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

input:

5
3 2 4 5 1
3 4 2 5 1

output:

1
2 

result:

ok OK, found solution, n = 5, ops = 1

Test #12:

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

input:

6
6 3 2 1 4 5
3 6 1 5 4 2

output:

-1

result:

ok OK, no solution

Test #13:

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

input:

6
6 5 2 4 3 1
6 2 5 4 3 1

output:

1
2 

result:

ok OK, found solution, n = 6, ops = 1

Test #14:

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

input:

7
7 2 5 1 4 6 3
6 2 7 3 4 5 1

output:

-1

result:

ok OK, no solution

Test #15:

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

input:

7
6 3 5 2 4 7 1
6 7 3 5 2 1 4

output:

5
5 6 4 3 2 

result:

ok OK, found solution, n = 7, ops = 5

Test #16:

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

input:

8
1 2 3 8 6 4 7 5
5 6 3 8 4 7 2 1

output:

-1

result:

ok OK, no solution

Test #17:

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

input:

8
1 5 7 6 2 4 3 8
1 5 4 2 7 8 3 6

output:

8
4 5 6 7 6 3 4 3 

result:

ok OK, found solution, n = 8, ops = 8

Test #18:

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

input:

9
6 3 8 2 9 5 1 4 7
4 3 7 9 6 2 1 5 8

output:

-1

result:

ok OK, no solution

Test #19:

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

input:

9
7 2 9 4 1 6 5 3 8
4 7 6 2 3 9 1 8 5

output:

10
7 8 5 6 3 4 5 2 3 1 

result:

ok OK, found solution, n = 9, ops = 10

Test #20:

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

input:

10
10 9 5 8 2 6 7 1 3 4
3 1 9 6 4 7 5 2 10 8

output:

-1

result:

ok OK, no solution

Test #21:

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

input:

10
9 10 8 5 2 7 3 6 4 1
2 1 9 8 5 3 10 7 4 6

output:

17
8 9 8 6 7 2 3 4 5 6 5 3 4 2 3 1 2 

result:

ok OK, found solution, n = 10, ops = 17

Test #22:

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

input:

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

output:

-1

result:

ok OK, no solution

Test #23:

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

input:

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

output:

44
18 19 8 9 10 11 12 13 14 15 16 17 16 12 5 6 7 8 9 10 11 6 7 8 9 5 6 7 3 4 5 6 1 2 3 4 5 1 2 3 4 3 2 1 

result:

ok OK, found solution, n = 20, ops = 44

Test #24:

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

input:

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

output:

-1

result:

ok OK, no solution

Test #25:

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

input:

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

output:

126
28 29 25 26 27 28 22 23 24 25 26 27 16 17 18 19 20 21 22 23 24 25 26 23 24 25 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 13 14 15 16 17 18 19 20 21 22 23 19 20 14 15 16 17 18 19 17 18 5 6 7 8 9 10 11 12 13 14 15 16 17 13 14 15 16 5 6 7 8 9 10 11 12 13 14 15 12 13 8 9 10 11 12 6 7 8 9 10 11 5 6...

result:

ok OK, found solution, n = 30, ops = 126

Test #26:

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

input:

40
29 18 19 12 24 39 13 8 34 40 38 15 6 33 35 4 7 26 1 10 32 27 25 9 22 16 37 14 36 2 3 20 30 17 21 5 28 23 31 11
39 19 13 29 36 21 4 30 5 15 10 37 38 22 18 23 16 33 25 27 32 40 14 34 2 26 12 7 11 8 9 28 1 35 24 3 31 6 20 17

output:

-1

result:

ok OK, no solution

Test #27:

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

input:

40
25 2 7 29 26 28 8 40 21 5 15 37 14 30 18 20 32 19 6 39 9 4 22 13 12 10 27 11 36 33 17 38 23 3 24 16 1 35 31 34
21 7 15 8 20 18 14 22 32 5 40 29 19 23 2 37 36 9 25 33 4 3 1 17 6 35 28 13 12 26 24 10 27 34 39 30 16 31 38 11

output:

233
28 29 30 31 32 33 34 35 36 37 38 39 31 32 33 34 35 36 37 38 37 34 35 36 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 25 26 27 28 29 30 31 32 24 25 26 27 28 29 30 31 29 30 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2...

result:

ok OK, found solution, n = 40, ops = 233

Test #28:

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

input:

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

output:

-1

result:

ok OK, no solution

Test #29:

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

input:

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

output:

287
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 40 41 42 43 44 45 46 47 48 43 44 45 46 47 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 43 39 40 41 42 39 40 41 39 40 23 24 25 26 27 28 29...

result:

ok OK, found solution, n = 50, ops = 287

Test #30:

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

input:

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

output:

-1

result:

ok OK, no solution

Test #31:

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

input:

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

output:

406
47 48 49 50 51 52 53 54 55 56 57 58 59 50 51 52 53 54 55 56 57 58 54 55 56 57 52 53 54 55 56 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 52 48 49 50 51 42 43 44 45 46 47 48 49 50 43 44 45 46 47 48 49 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 17 18 19 20 21 22 23 24 25 26 27...

result:

ok OK, found solution, n = 60, ops = 406

Test #32:

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

input:

70
44 48 37 56 19 11 38 2 50 49 30 43 41 22 59 35 61 70 65 69 4 21 24 45 60 64 32 39 27 31 26 3 33 42 54 58 62 53 9 12 13 36 66 55 18 28 63 15 34 20 1 17 23 52 51 46 16 8 6 7 29 40 68 5 67 57 25 10 14 47
60 64 21 35 12 49 50 43 11 62 1 14 57 34 33 36 70 61 58 45 56 63 13 29 68 38 69 65 4 16 46 8 22 ...

output:

-1

result:

ok OK, no solution

Test #33:

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

input:

70
18 24 37 36 16 21 39 38 32 62 14 12 35 4 44 60 20 8 26 51 69 28 66 7 11 6 29 30 65 13 42 1 49 3 68 10 17 2 33 56 41 25 15 64 61 70 43 27 48 45 34 52 40 59 23 50 22 5 31 54 63 9 57 55 19 58 67 53 46 47
12 39 32 16 4 37 8 44 36 38 51 62 18 14 28 33 66 35 24 60 29 17 61 49 65 26 69 48 21 7 1 13 20 3...

output:

429
66 67 68 69 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 54 55 56 57 58 59 60 61 62 63 64 65 66 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 63 64 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61...

result:

ok OK, found solution, n = 70, ops = 429

Test #34:

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

input:

80
56 61 10 11 17 50 53 32 27 63 69 76 35 75 77 9 29 43 31 7 24 5 38 67 55 33 14 41 72 57 16 71 37 64 70 42 40 78 36 28 68 80 25 20 59 79 54 51 65 47 12 15 74 39 45 21 66 34 22 18 46 8 58 30 13 1 73 23 52 44 60 4 19 6 49 26 48 3 2 62
27 74 52 66 28 70 80 48 17 18 5 31 41 24 57 47 10 21 40 12 19 65 4...

output:

-1

result:

ok OK, no solution

Test #35:

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

input:

80
71 54 47 22 17 80 53 15 37 8 24 18 62 21 10 72 4 30 69 56 35 78 48 9 38 75 46 52 34 19 50 70 64 39 27 1 6 55 65 79 33 51 74 40 12 29 49 5 73 60 23 26 36 28 76 31 59 68 3 42 67 11 20 41 61 16 44 45 66 32 63 25 2 43 58 7 13 14 77 57
10 35 30 29 71 15 80 4 37 47 17 8 38 72 34 3 54 18 75 27 26 53 56 ...

output:

655
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 68 69 70 71 72 73 74 75 76 77 78 76 77 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 72 73 71 72 55...

result:

ok OK, found solution, n = 80, ops = 655

Test #36:

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

input:

90
68 31 85 60 49 47 52 20 51 84 34 2 29 76 28 63 40 3 44 61 82 55 79 43 27 62 45 81 23 46 88 6 80 50 73 36 71 87 26 67 10 17 42 59 8 5 56 24 90 11 1 32 9 83 89 66 18 57 19 39 15 22 33 30 77 58 74 37 12 14 35 48 53 75 38 69 65 13 70 54 21 25 86 16 78 41 4 72 64 7
72 36 70 8 84 31 57 19 29 47 58 51 1...

output:

-1

result:

ok OK, no solution

Test #37:

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

input:

90
32 17 72 76 42 84 65 36 50 1 63 16 44 40 10 18 54 34 12 67 87 60 19 45 49 6 29 26 53 52 74 61 71 30 20 70 47 48 33 14 11 23 78 77 82 2 4 83 7 13 88 9 57 46 21 3 68 89 86 79 51 59 85 37 81 56 75 15 62 66 28 64 43 5 80 24 41 55 35 27 73 25 38 58 90 31 22 69 39 8
76 63 17 84 42 4 50 72 60 67 36 54 5...

output:

596
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 85 86 87 88 81 82 83 84 85 86 76 77 78 79 80 81 82 83 84 85 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 77 78 79 80 81 82 83 69 70 71 72 73 74 75 76 77 78 79 80 81...

result:

ok OK, found solution, n = 90, ops = 596

Test #38:

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

input:

98
87 88 97 35 19 47 80 12 49 66 91 62 73 43 48 54 68 72 26 21 37 60 93 6 89 41 45 56 24 38 30 2 77 71 16 64 40 51 50 18 10 74 67 82 83 29 94 75 33 58 57 65 52 11 1 31 78 84 5 70 90 7 69 4 14 25 27 63 92 96 59 9 86 32 36 28 95 15 61 81 3 20 53 22 39 85 23 8 44 17 13 55 34 46 98 42 76 79
59 55 49 40 ...

output:

-1

result:

ok OK, no solution

Test #39:

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

input:

98
24 34 97 9 41 5 74 54 82 76 60 55 43 53 38 72 75 29 33 42 17 68 32 25 15 35 88 83 10 7 6 79 1 11 69 26 18 63 91 71 28 62 80 77 22 49 87 3 46 31 66 90 23 70 78 44 4 95 16 56 65 98 85 93 57 61 89 19 86 64 21 92 96 73 84 51 94 48 2 58 45 30 13 20 36 12 40 47 59 8 52 27 37 50 39 14 81 67
43 72 29 54 ...

output:

787
93 94 95 96 97 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 85 86 87 88 89 90 91 92 93 94 95 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 87 88 89 90 91 92 79 80 81...

result:

ok OK, found solution, n = 98, ops = 787

Test #40:

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

input:

98
87 88 97 35 19 47 80 12 49 66 91 62 73 43 48 54 68 72 26 21 37 60 93 6 89 41 45 56 24 38 30 2 77 71 16 64 40 51 50 18 10 74 67 82 83 29 94 75 33 58 57 65 52 11 1 31 78 84 5 70 90 7 69 4 14 25 27 63 92 96 59 9 86 32 36 28 95 15 61 81 3 20 53 22 39 85 23 8 44 17 13 55 34 46 98 42 76 79
97 96 93 91 ...

output:

1442
95 96 97 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 9...

result:

ok OK, found solution, n = 98, ops = 1442

Test #41:

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

input:

98
87 88 97 35 19 47 80 12 49 66 91 62 73 43 48 54 68 72 26 21 37 60 93 6 89 41 45 56 24 38 30 2 77 71 16 64 40 51 50 18 10 74 67 82 83 29 94 75 33 58 57 65 52 11 1 31 78 84 5 70 90 7 69 4 14 25 27 63 92 96 59 9 86 32 36 28 95 15 61 81 3 20 53 22 39 85 23 8 44 17 13 55 34 46 98 42 76 79
2 6 7 10 12 ...

output:

1480
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 58 59 60 61 62 6...

result:

ok OK, found solution, n = 98, ops = 1480

Test #42:

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

input:

99
64 89 91 53 19 98 96 81 54 47 92 27 30 2 58 51 63 22 66 33 42 93 86 94 52 13 25 97 26 1 9 79 4 18 44 12 24 34 11 8 21 67 62 41 14 40 83 15 49 90 76 72 16 3 74 20 23 55 5 7 68 29 48 73 32 82 70 60 71 45 28 88 31 80 87 65 43 46 84 39 37 85 69 6 10 17 99 50 59 36 61 77 78 38 75 57 95 56 35
90 58 25 ...

output:

-1

result:

ok OK, no solution

Test #43:

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

input:

99
35 85 11 27 2 51 66 83 42 14 7 30 41 17 91 32 56 3 48 65 64 80 70 19 24 95 4 96 33 75 62 99 77 40 93 10 12 58 20 81 89 63 90 74 15 5 76 53 38 25 67 31 39 21 18 78 36 44 79 1 72 82 52 37 50 92 68 86 98 43 69 87 54 9 26 22 55 46 84 73 47 8 60 94 97 34 88 61 29 59 13 6 71 16 23 28 57 45 49
11 30 24 ...

output:

900
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 84 85 86 87 88 89 90 91 92 93 94 95 96 97 95 96 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 94 89 90 91 92 93 84 85 86 87 88 89 90 91 92 90 91 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85...

result:

ok OK, found solution, n = 99, ops = 900

Test #44:

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

input:

99
64 89 91 53 19 98 96 81 54 47 92 27 30 2 58 51 63 22 66 33 42 93 86 94 52 13 25 97 26 1 9 79 4 18 44 12 24 34 11 8 21 67 62 41 14 40 83 15 49 90 76 72 16 3 74 20 23 55 5 7 68 29 48 73 32 82 70 60 71 45 28 88 31 80 87 65 43 46 84 39 37 85 69 6 10 17 99 50 59 36 61 77 78 38 75 57 95 56 35
98 96 91 ...

output:

1599
87 88 89 90 91 92 93 94 95 96 97 98 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 95 96 24 25 26 27 28 29 30 31 32 33 34 35 36 37 3...

result:

ok OK, found solution, n = 99, ops = 1599

Test #45:

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

input:

99
64 89 91 53 19 98 96 81 54 47 92 27 30 2 58 51 63 22 66 33 42 93 86 94 52 13 25 97 26 1 9 79 4 18 44 12 24 34 11 8 21 67 62 41 14 40 83 15 49 90 76 72 16 3 74 20 23 55 5 7 68 29 48 73 32 82 70 60 71 45 28 88 31 80 87 65 43 46 84 39 37 85 69 6 10 17 99 50 59 36 61 77 78 38 75 57 95 56 35
2 4 5 9 1...

output:

1785
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 8...

result:

ok OK, found solution, n = 99, ops = 1785

Test #46:

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

input:

100
41 58 50 82 33 91 90 6 48 89 69 56 16 42 27 24 53 45 75 84 72 37 20 47 92 35 10 76 14 5 26 67 28 57 46 19 77 81 29 39 51 86 23 96 70 11 12 17 79 80 94 13 78 68 3 38 22 64 34 54 40 52 7 25 93 63 43 98 1 88 95 2 49 83 36 30 61 32 31 9 66 18 15 4 74 8 87 99 55 100 62 65 97 73 71 44 21 59 85 60
86 5...

output:

-1

result:

ok OK, no solution

Test #47:

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

input:

100
51 27 45 32 4 90 26 40 29 61 99 62 18 75 36 58 13 43 20 47 71 68 24 15 31 94 97 10 11 72 21 9 16 60 59 64 48 100 5 66 74 55 91 77 84 96 34 37 50 73 70 63 1 92 69 85 23 49 53 87 79 44 81 82 38 86 2 98 57 78 8 19 33 46 39 54 52 41 28 67 88 80 17 3 22 12 76 89 56 7 93 42 6 25 30 83 35 95 65 14
27 2...

output:

927
89 90 91 92 93 94 95 96 97 98 99 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 86 87 88 89 90 91 92 93 94 95 96 97 94 95 96 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 91 92 93 94 89 90 91 92 93 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 73 74 75...

result:

ok OK, found solution, n = 100, ops = 927

Test #48:

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

input:

100
41 58 50 82 33 91 90 6 48 89 69 56 16 42 27 24 53 45 75 84 72 37 20 47 92 35 10 76 14 5 26 67 28 57 46 19 77 81 29 39 51 86 23 96 70 11 12 17 79 80 94 13 78 68 3 38 22 64 34 54 40 52 7 25 93 63 43 98 1 88 95 2 49 83 36 30 61 32 31 9 66 18 15 4 74 8 87 99 55 100 62 65 97 73 71 44 21 59 85 60
98 9...

output:

1576
90 91 92 93 94 95 96 97 98 99 88 89 90 91 92 93 94 95 96 97 98 91 92 93 94 95 96 97 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 25 26 27 28 29 30 31 32 33 34 35 36 37 3...

result:

ok OK, found solution, n = 100, ops = 1576

Test #49:

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

input:

100
41 58 50 82 33 91 90 6 48 89 69 56 16 42 27 24 53 45 75 84 72 37 20 47 92 35 10 76 14 5 26 67 28 57 46 19 77 81 29 39 51 86 23 96 70 11 12 17 79 80 94 13 78 68 3 38 22 64 34 54 40 52 7 25 93 63 43 98 1 88 95 2 49 83 36 30 61 32 31 9 66 18 15 4 74 8 87 99 55 100 62 65 97 73 71 44 21 59 85 60
1 3 ...

output:

1682
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 8...

result:

ok OK, found solution, n = 100, ops = 1682

Test #50:

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

input:

100
94 100 37 78 98 66 56 2 72 74 88 9 92 41 82 24 52 45 48 39 31 36 25 17 30 26 49 54 59 77 91 1 95 70 76 18 11 63 84 99 3 96 19 85 87 22 46 34 29 75 33 28 67 90 79 4 71 47 20 73 81 16 50 8 38 7 43 23 57 93 68 40 69 80 83 14 65 32 15 89 35 42 5 97 21 51 13 27 44 6 55 60 53 10 64 62 12 86 58 61
35 4...

output:

-1

result:

ok OK, no solution

Test #51:

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

input:

100
40 84 74 80 95 56 76 67 55 25 82 32 10 19 43 38 52 94 11 54 58 88 62 50 89 81 93 36 49 48 8 85 59 87 29 39 60 34 27 4 9 97 100 68 21 3 18 63 44 46 33 73 90 77 65 14 2 72 79 92 98 53 57 35 37 83 91 20 78 26 7 23 45 99 42 5 13 30 61 51 31 70 71 75 41 47 15 6 1 16 96 22 69 66 64 86 12 24 17 28
88 8...

output:

824
98 99 93 94 95 96 97 98 91 92 93 94 95 96 97 96 91 92 93 94 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 91 92 82 83 84 85 86 87 88 89 90 91 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84...

result:

ok OK, found solution, n = 100, ops = 824

Test #52:

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

input:

100
94 100 37 78 98 66 56 2 72 74 88 9 92 41 82 24 52 45 48 39 31 36 25 17 30 26 49 54 59 77 91 1 95 70 76 18 11 63 84 99 3 96 19 85 87 22 46 34 29 75 33 28 67 90 79 4 71 47 20 73 81 16 50 8 38 7 43 23 57 93 68 40 69 80 83 14 65 32 15 89 35 42 5 97 21 51 13 27 44 6 55 60 53 10 64 62 12 86 58 61
100 ...

output:

1459
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 6...

result:

ok OK, found solution, n = 100, ops = 1459

Test #53:

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

input:

100
94 100 37 78 98 66 56 2 72 74 88 9 92 41 82 24 52 45 48 39 31 36 25 17 30 26 49 54 59 77 91 1 95 70 76 18 11 63 84 99 3 96 19 85 87 22 46 34 29 75 33 28 67 90 79 4 71 47 20 73 81 16 50 8 38 7 43 23 57 93 68 40 69 80 83 14 65 32 15 89 35 42 5 97 21 51 13 27 44 6 55 60 53 10 64 62 12 86 58 61
2 3 ...

output:

1619
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 89 90 91 92 93 94 95 96 97 98 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 8...

result:

ok OK, found solution, n = 100, ops = 1619

Test #54:

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

input:

100
56 3 29 94 81 20 77 28 62 79 1 10 34 49 55 36 66 26 84 44 54 39 91 38 57 72 50 9 12 70 4 24 87 61 23 22 35 73 82 86 25 5 97 69 74 60 78 92 42 21 40 67 85 52 16 99 31 17 98 53 80 71 64 19 32 33 48 45 93 65 13 37 63 83 96 95 76 2 46 51 100 43 15 30 8 14 68 58 59 88 41 11 27 6 75 18 47 7 89 90
59 8...

output:

-1

result:

ok OK, no solution

Test #55:

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

input:

100
97 89 92 88 59 67 70 51 11 39 69 50 73 79 49 74 98 14 72 17 100 87 84 27 86 4 96 13 66 10 7 77 82 78 53 5 19 12 80 85 20 90 25 57 58 2 29 63 33 81 95 62 65 30 76 46 9 24 91 34 48 1 45 83 31 35 55 52 47 71 15 44 54 22 64 32 61 75 8 38 43 37 3 16 56 6 36 18 94 99 28 23 40 26 21 93 42 60 41 68
73 1...

output:

854
92 93 94 95 96 97 98 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 85 86 87 88 89 90 91 92 93 94 95 94 90 91 92 93 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 76 77...

result:

ok OK, found solution, n = 100, ops = 854

Test #56:

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

input:

100
56 3 29 94 81 20 77 28 62 79 1 10 34 49 55 36 66 26 84 44 54 39 91 38 57 72 50 9 12 70 4 24 87 61 23 22 35 73 82 86 25 5 97 69 74 60 78 92 42 21 40 67 85 52 16 99 31 17 98 53 80 71 64 19 32 33 48 45 93 65 13 37 63 83 96 95 76 2 46 51 100 43 15 30 8 14 68 58 59 88 41 11 27 6 75 18 47 7 89 90
99 9...

output:

1568
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 8...

result:

ok OK, found solution, n = 100, ops = 1568

Test #57:

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

input:

100
56 3 29 94 81 20 77 28 62 79 1 10 34 49 55 36 66 26 84 44 54 39 91 38 57 72 50 9 12 70 4 24 87 61 23 22 35 73 82 86 25 5 97 69 74 60 78 92 42 21 40 67 85 52 16 99 31 17 98 53 80 71 64 19 32 33 48 45 93 65 13 37 63 83 96 95 76 2 46 51 100 43 15 30 8 14 68 58 59 88 41 11 27 6 75 18 47 7 89 90
1 3 ...

output:

1714
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 97 98 84 85 86 87 88 89 90 91 92 93 94 95 96 97 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 8...

result:

ok OK, found solution, n = 100, ops = 1714

Test #58:

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

input:

100
12 84 69 22 97 33 89 28 60 67 85 75 95 21 48 11 88 91 64 76 65 30 24 78 40 73 80 35 100 58 46 14 62 74 44 10 99 36 63 5 87 15 32 79 77 96 26 39 13 90 37 68 53 19 2 70 47 41 4 29 31 38 93 9 59 49 61 45 34 83 7 50 82 94 6 27 71 20 86 81 51 23 57 17 16 55 98 92 25 8 52 72 18 56 42 43 66 54 1 3
17 8...

output:

-1

result:

ok OK, no solution

Test #59:

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

input:

100
47 49 76 4 89 25 72 81 64 11 18 10 95 85 41 1 23 30 69 79 34 43 68 77 96 62 55 67 9 28 93 45 19 100 16 7 15 40 73 35 84 99 21 46 39 82 50 63 42 54 13 98 27 14 8 71 88 26 57 22 29 80 78 52 94 86 87 83 31 51 2 24 59 36 5 12 32 66 6 48 17 3 92 91 33 70 44 90 97 65 20 60 53 61 37 58 38 74 75 56
30 1...

output:

789
87 88 89 90 91 92 93 94 95 96 97 98 99 98 96 97 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 87 88 89 90 91 92 93 94 95 91 92 93 94 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 87 88 89 90 91 92 87 88 89 90 91 77 78 79 80 81 82 83...

result:

ok OK, found solution, n = 100, ops = 789

Test #60:

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

input:

100
12 84 69 22 97 33 89 28 60 67 85 75 95 21 48 11 88 91 64 76 65 30 24 78 40 73 80 35 100 58 46 14 62 74 44 10 99 36 63 5 87 15 32 79 77 96 26 39 13 90 37 68 53 19 2 70 47 41 4 29 31 38 93 9 59 49 61 45 34 83 7 50 82 94 6 27 71 20 86 81 51 23 57 17 16 55 98 92 25 8 52 72 18 56 42 43 66 54 1 3
100 ...

output:

1618
87 88 89 90 91 92 93 94 95 96 97 98 99 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 85 86 87 88 89 90 91 9...

result:

ok OK, found solution, n = 100, ops = 1618

Test #61:

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

input:

100
12 84 69 22 97 33 89 28 60 67 85 75 95 21 48 11 88 91 64 76 65 30 24 78 40 73 80 35 100 58 46 14 62 74 44 10 99 36 63 5 87 15 32 79 77 96 26 39 13 90 37 68 53 19 2 70 47 41 4 29 31 38 93 9 59 49 61 45 34 83 7 50 82 94 6 27 71 20 86 81 51 23 57 17 16 55 98 92 25 8 52 72 18 56 42 43 66 54 1 3
2 5 ...

output:

1728
99 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 88 89 90 91 92 93 94 95 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 9...

result:

ok OK, found solution, n = 100, ops = 1728

Test #62:

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

input:

100
48 27 58 73 51 10 36 100 25 91 57 42 18 80 82 39 33 24 13 85 3 77 84 81 9 15 43 68 87 92 2 53 17 54 1 30 86 41 63 21 45 98 38 61 49 74 29 64 71 60 94 76 99 4 12 69 56 67 95 14 97 93 70 46 6 37 78 23 22 35 83 52 89 44 40 59 90 75 96 66 79 31 28 26 65 47 88 55 19 7 16 34 62 72 50 32 5 11 20 8
54 4...

output:

-1

result:

ok OK, no solution

Test #63:

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

input:

100
73 77 70 60 47 13 66 98 2 20 12 100 52 46 34 40 97 43 17 18 84 75 86 72 41 92 78 93 29 16 23 14 15 39 57 32 38 49 88 9 33 94 69 8 22 19 87 63 80 25 76 1 36 62 65 95 50 99 7 30 71 53 58 44 74 59 83 68 82 42 89 5 51 10 91 24 45 61 79 37 27 54 6 4 3 85 21 64 26 67 31 90 48 11 55 35 81 28 96 56
77 1...

output:

885
97 98 99 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 88 89 90 91 92 93 94 95 96 89 90 91 92 93 94 95 87 88 89 90 91 92 93 94 88 89 90 91 92 93 85 86 87 88 89 90 91 92 87 88 89...

result:

ok OK, found solution, n = 100, ops = 885

Test #64:

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

input:

100
48 27 58 73 51 10 36 100 25 91 57 42 18 80 82 39 33 24 13 85 3 77 84 81 9 15 43 68 87 92 2 53 17 54 1 30 86 41 63 21 45 98 38 61 49 74 29 64 71 60 94 76 99 4 12 69 56 67 95 14 97 93 70 46 6 37 78 23 22 35 83 52 89 44 40 59 90 75 96 66 79 31 28 26 65 47 88 55 19 7 16 34 62 72 50 32 5 11 20 8
100 ...

output:

1664
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 8...

result:

ok OK, found solution, n = 100, ops = 1664

Test #65:

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

input:

100
48 27 58 73 51 10 36 100 25 91 57 42 18 80 82 39 33 24 13 85 3 77 84 81 9 15 43 68 87 92 2 53 17 54 1 30 86 41 63 21 45 98 38 61 49 74 29 64 71 60 94 76 99 4 12 69 56 67 95 14 97 93 70 46 6 37 78 23 22 35 83 52 89 44 40 59 90 75 96 66 79 31 28 26 65 47 88 55 19 7 16 34 62 72 50 32 5 11 20 8
3 4 ...

output:

1600
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 6...

result:

ok OK, found solution, n = 100, ops = 1600

Test #66:

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

input:

100
84 18 31 71 99 56 61 34 74 52 48 22 73 40 77 33 1 78 95 100 20 23 21 98 65 82 94 10 53 79 68 28 58 90 69 14 80 63 72 2 50 30 36 41 3 6 81 60 66 32 16 97 70 54 47 38 29 45 92 44 7 17 13 93 11 55 42 37 62 43 25 39 83 87 5 89 96 24 85 4 57 59 67 19 86 8 75 12 91 15 76 9 27 49 26 35 88 64 46 51
83 6...

output:

-1

result:

ok OK, no solution

Test #67:

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

input:

100
37 1 5 84 78 61 40 11 57 97 81 6 22 8 80 62 53 94 32 60 47 89 20 93 18 75 16 9 49 96 69 3 25 79 46 98 27 35 99 77 55 42 2 71 56 23 54 76 63 39 67 44 33 74 38 13 31 19 64 14 100 86 87 28 4 92 85 7 59 91 51 58 26 21 50 65 30 34 24 72 17 48 10 73 90 15 83 45 95 43 68 29 12 70 82 41 52 36 88 66
75 8...

output:

770
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 87 88 89 90 91 92 93 94 95 96 97 93 94 95 96 87 88 89 90 91 92 93 94 95 90 91 92 93 94 87 88 89 90 91 92 93 81 82 83 84...

result:

ok OK, found solution, n = 100, ops = 770

Test #68:

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

input:

100
84 18 31 71 99 56 61 34 74 52 48 22 73 40 77 33 1 78 95 100 20 23 21 98 65 82 94 10 53 79 68 28 58 90 69 14 80 63 72 2 50 30 36 41 3 6 81 60 66 32 16 97 70 54 47 38 29 45 92 44 7 17 13 93 11 55 42 37 62 43 25 39 83 87 5 89 96 24 85 4 57 59 67 19 86 8 75 12 91 15 76 9 27 49 26 35 88 64 46 51
99 9...

output:

1589
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 9...

result:

ok OK, found solution, n = 100, ops = 1589

Test #69:

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

input:

100
84 18 31 71 99 56 61 34 74 52 48 22 73 40 77 33 1 78 95 100 20 23 21 98 65 82 94 10 53 79 68 28 58 90 69 14 80 63 72 2 50 30 36 41 3 6 81 60 66 32 16 97 70 54 47 38 29 45 92 44 7 17 13 93 11 55 42 37 62 43 25 39 83 87 5 89 96 24 85 4 57 59 67 19 86 8 75 12 91 15 76 9 27 49 26 35 88 64 46 51
1 2 ...

output:

1625
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 90 91 92 93 94 95 96 97 86 87 88 89 90 91 92 93 94 95 96 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 86 87 8...

result:

ok OK, found solution, n = 100, ops = 1625

Test #70:

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

input:

100
44 28 85 94 32 25 68 31 7 8 26 67 96 52 2 14 12 49 69 11 99 84 90 23 9 91 33 21 60 89 75 13 98 88 86 15 18 34 63 71 53 16 57 38 36 41 55 76 37 30 82 5 92 39 19 58 1 40 24 78 17 87 61 93 95 50 77 3 22 54 83 80 59 46 20 70 97 66 73 72 56 6 81 27 45 29 35 43 47 65 4 64 79 62 51 48 42 10 100 74
93 3...

output:

-1

result:

ok OK, no solution

Test #71:

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

input:

100
60 80 13 15 46 66 43 92 45 3 29 50 32 6 77 16 8 14 25 86 94 90 93 48 70 27 28 39 53 36 21 40 67 23 97 81 22 61 100 95 42 52 87 44 88 65 78 10 72 31 7 33 11 2 99 51 26 59 75 4 37 96 68 55 58 34 74 79 84 64 63 71 47 19 85 49 69 38 1 20 30 62 17 18 9 76 89 82 98 57 83 24 56 12 54 91 5 35 73 41
29 8...

output:

956
87 88 89 90 91 92 93 94 95 96 97 98 99 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 84 85 86 87 88 89 90 91 92 93 94 95 96 97 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 90 91 92 93 94 95 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78...

result:

ok OK, found solution, n = 100, ops = 956

Test #72:

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

input:

100
44 28 85 94 32 25 68 31 7 8 26 67 96 52 2 14 12 49 69 11 99 84 90 23 9 91 33 21 60 89 75 13 98 88 86 15 18 34 63 71 53 16 57 38 36 41 55 76 37 30 82 5 92 39 19 58 1 40 24 78 17 87 61 93 95 50 77 3 22 54 83 80 59 46 20 70 97 66 73 72 56 6 81 27 45 29 35 43 47 65 4 64 79 62 51 48 42 10 100 74
99 9...

output:

1615
99 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 53 54 55 56 57 58 59 60 61 6...

result:

ok OK, found solution, n = 100, ops = 1615

Test #73:

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

input:

100
44 28 85 94 32 25 68 31 7 8 26 67 96 52 2 14 12 49 69 11 99 84 90 23 9 91 33 21 60 89 75 13 98 88 86 15 18 34 63 71 53 16 57 38 36 41 55 76 37 30 82 5 92 39 19 58 1 40 24 78 17 87 61 93 95 50 77 3 22 54 83 80 59 46 20 70 97 66 73 72 56 6 81 27 45 29 35 43 47 65 4 64 79 62 51 48 42 10 100 74
2 3 ...

output:

1555
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 90 91 92 93 94 95 96 97 98 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 95 96 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 4...

result:

ok OK, found solution, n = 100, ops = 1555

Test #74:

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

input:

100
24 99 89 84 39 94 69 55 64 74 42 7 54 6 53 65 56 61 79 50 4 5 71 31 43 68 23 9 17 90 40 27 57 88 32 75 67 78 63 26 45 51 34 60 76 85 100 10 22 11 73 19 25 8 18 14 2 93 37 20 98 41 52 49 21 81 83 62 48 97 58 47 46 86 44 91 29 30 33 36 96 28 16 70 66 38 80 12 13 77 3 82 1 35 92 15 87 59 95 72
86 1...

output:

-1

result:

ok OK, no solution

Test #75:

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

input:

100
87 52 84 40 67 54 99 43 45 46 41 28 14 75 47 29 56 58 62 26 15 27 16 4 7 98 76 25 74 12 23 59 11 9 71 32 92 6 2 66 39 42 1 20 24 55 53 63 85 65 13 100 19 30 34 3 57 82 81 96 86 8 35 73 94 83 37 89 90 10 5 51 69 88 70 78 49 33 44 21 36 60 38 61 17 18 91 79 50 64 22 72 80 95 68 48 93 97 77 31
52 4...

output:

813
96 97 98 99 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 91 92 93 94 95 96 97 89 90 91 92 93 94 95 96 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 84 85 86 87 88 89 90 91 92 93 94 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 89 90 91 92 82 83 84 85 86 87 88 89 90 91...

result:

ok OK, found solution, n = 100, ops = 813

Test #76:

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

input:

100
24 99 89 84 39 94 69 55 64 74 42 7 54 6 53 65 56 61 79 50 4 5 71 31 43 68 23 9 17 90 40 27 57 88 32 75 67 78 63 26 45 51 34 60 76 85 100 10 22 11 73 19 25 8 18 14 2 93 37 20 98 41 52 49 21 81 83 62 48 97 58 47 46 86 44 91 29 30 33 36 96 28 16 70 66 38 80 12 13 77 3 82 1 35 92 15 87 59 95 72
99 9...

output:

1639
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 98 94 95 96 97 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 4...

result:

ok OK, found solution, n = 100, ops = 1639

Test #77:

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

input:

100
24 99 89 84 39 94 69 55 64 74 42 7 54 6 53 65 56 61 79 50 4 5 71 31 43 68 23 9 17 90 40 27 57 88 32 75 67 78 63 26 45 51 34 60 76 85 100 10 22 11 73 19 25 8 18 14 2 93 37 20 98 41 52 49 21 81 83 62 48 97 58 47 46 86 44 91 29 30 33 36 96 28 16 70 66 38 80 12 13 77 3 82 1 35 92 15 87 59 95 72
2 4 ...

output:

1777
93 94 95 96 97 98 99 91 92 93 94 95 96 97 98 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 14 15 16 17 18 19 20 2...

result:

ok OK, found solution, n = 100, ops = 1777

Test #78:

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

input:

100
49 68 13 38 77 54 39 72 81 42 45 70 7 65 29 75 98 99 90 20 28 43 9 47 82 100 53 71 73 78 24 86 5 22 67 92 3 27 64 88 33 6 17 52 95 11 4 10 61 56 23 34 31 58 85 19 93 87 51 69 8 35 21 63 36 83 91 2 89 46 16 1 25 59 40 12 94 79 57 60 48 80 62 30 37 32 50 26 84 18 41 15 66 55 97 14 74 76 96 44
73 6...

output:

-1

result:

ok OK, no solution

Test #79:

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

input:

100
42 28 81 59 33 53 1 22 21 3 56 26 57 7 25 12 15 86 44 48 29 70 99 45 93 73 14 23 64 100 17 92 31 20 61 38 8 50 60 78 74 94 55 11 95 75 69 63 66 65 97 35 67 79 5 34 88 90 13 80 10 77 41 83 62 58 54 84 16 72 2 30 46 51 76 87 9 71 91 98 24 4 37 49 18 47 36 43 39 85 52 19 96 68 89 32 27 82 6 40
26 5...

output:

782
86 87 88 89 90 91 92 93 94 95 96 97 98 99 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 90 91 92 93 94 95 96 97 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 91 92 93 94 95 84 85 86 87 88 89 90 91 92 93 94 91 92 93 79 80 81 82 83 84 85 86 87 88 89 90 91 92 91 88 89 90 80 81 82 83 84 85...

result:

ok OK, found solution, n = 100, ops = 782

Test #80:

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

input:

100
49 68 13 38 77 54 39 72 81 42 45 70 7 65 29 75 98 99 90 20 28 43 9 47 82 100 53 71 73 78 24 86 5 22 67 92 3 27 64 88 33 6 17 52 95 11 4 10 61 56 23 34 31 58 85 19 93 87 51 69 8 35 21 63 36 83 91 2 89 46 16 1 25 59 40 12 94 79 57 60 48 80 62 30 37 32 50 26 84 18 41 15 66 55 97 14 74 76 96 44
98 9...

output:

1577
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 4...

result:

ok OK, found solution, n = 100, ops = 1577

Test #81:

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

input:

100
49 68 13 38 77 54 39 72 81 42 45 70 7 65 29 75 98 99 90 20 28 43 9 47 82 100 53 71 73 78 24 86 5 22 67 92 3 27 64 88 33 6 17 52 95 11 4 10 61 56 23 34 31 58 85 19 93 87 51 69 8 35 21 63 36 83 91 2 89 46 16 1 25 59 40 12 94 79 57 60 48 80 62 30 37 32 50 26 84 18 41 15 66 55 97 14 74 76 96 44
3 5 ...

output:

1571
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 8...

result:

ok OK, found solution, n = 100, ops = 1571

Test #82:

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

input:

100
13 90 5 100 2 45 11 64 24 63 35 26 69 17 95 44 58 74 54 85 71 9 80 41 94 55 19 89 42 60 21 84 75 32 1 86 31 81 12 7 47 40 50 82 22 66 96 52 10 77 99 79 61 70 97 73 51 49 27 56 57 8 34 29 62 14 88 48 43 15 4 16 68 36 87 92 65 33 18 91 83 37 53 93 3 76 20 38 98 46 78 59 39 6 72 30 28 23 67 25
39 6...

output:

-1

result:

ok OK, no solution

Test #83:

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

input:

100
27 59 42 56 88 83 31 75 17 4 26 80 9 71 98 57 63 39 81 29 25 95 16 11 41 73 67 32 46 50 94 79 10 36 96 74 8 62 7 18 28 61 69 91 45 40 87 82 85 65 48 64 49 33 55 51 14 76 13 12 90 43 77 47 52 53 19 23 24 100 3 15 22 60 35 21 1 93 20 92 86 6 54 68 5 37 38 84 99 30 2 44 34 89 97 70 78 72 58 66
4 73...

output:

799
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 98 93 94 95 96 97 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 85 86 87 88 89 90 91 92 93 94 95 81 82 83 84 85 86 87 88 89 90 91 92 93 94 87 88 89 90 91 92 93 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 90 91 90...

result:

ok OK, found solution, n = 100, ops = 799

Test #84:

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

input:

100
13 90 5 100 2 45 11 64 24 63 35 26 69 17 95 44 58 74 54 85 71 9 80 41 94 55 19 89 42 60 21 84 75 32 1 86 31 81 12 7 47 40 50 82 22 66 96 52 10 77 99 79 61 70 97 73 51 49 27 56 57 8 34 29 62 14 88 48 43 15 4 16 68 36 87 92 65 33 18 91 83 37 53 93 3 76 20 38 98 46 78 59 39 6 72 30 28 23 67 25
100 ...

output:

1588
89 90 91 92 93 94 95 96 97 98 99 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 9...

result:

ok OK, found solution, n = 100, ops = 1588

Test #85:

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

input:

100
13 90 5 100 2 45 11 64 24 63 35 26 69 17 95 44 58 74 54 85 71 9 80 41 94 55 19 89 42 60 21 84 75 32 1 86 31 81 12 7 47 40 50 82 22 66 96 52 10 77 99 79 61 70 97 73 51 49 27 56 57 8 34 29 62 14 88 48 43 15 4 16 68 36 87 92 65 33 18 91 83 37 53 93 3 76 20 38 98 46 78 59 39 6 72 30 28 23 67 25
2 5 ...

output:

1514
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 8...

result:

ok OK, found solution, n = 100, ops = 1514