QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#425192#8724. SeptemberASGA_RedSea100 ✓149ms23892kbC++231.8kb2024-05-30 00:22:322024-05-30 00:22:32

Judging History

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

  • [2024-05-30 00:22:32]
  • 评测
  • 测评结果:100
  • 用时:149ms
  • 内存:23892kb
  • [2024-05-30 00:22:32]
  • 提交

answer

/**

                                    * بسم الله الرحمن الرحيم *

                ﴾ رَبِّ اشْرَحْ لِي صَدْرِي * وَيَسِّرْ لِي أَمْرِي * وَاحْلُلْ عُقْدَةً مِّن لِّسَانِي * يَفْقَهُوا قَوْلِي ﴿

*/

/// author : "ASGA"

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#include "september.h"

using namespace std;
using ll = long long;


void calc(int i,vector <vector <int>>& a,vector <int>& p,vector <int>& g){
    if(i > 0)g[i] = max(g[i],p[i]);
    for(const auto& j : a[i]){
        calc(j,a,p,g);

        if(i > 0)g[i] = max(g[i],g[j]);
    }
}

int solve(int n,int m,vector <int> f,vector <vector <int>> s){
    vector <vector <int>> a(n);
    for(int i = 1;i < n;i++){
        a[f[i]].push_back(i);
    }

    vector <vector <int>> p(m,vector <int> (n,0));
    for(int i = 0;i < m;i++){
        for(int j = 0;j < n - 1;j++){
            p[i][s[i][j]] = j;
        }
    }

    vector <vector <int>> g(m,vector <int> (n,0));
    for(int i = 0;i < m;i++){
        calc(0,a,p[i],g[i]);
    }

    int lstd = 0,pl = 0,k = 0;

    int mx = 0;

    while(lstd < n-1){
        mx = 0;
        while(1){
            for(int i = 0;i < m;i++){
                for(int j = pl;j < n-1;j++){
                    mx = max(mx,g[i][s[i][j]]);
                    if(j == mx){
                        mx = 0;
                        for(int h = pl;h <= j;h++)mx = max(mx,g[(i + 1) % m][s[i][h]]);
                        break;
                    }
                }
            }

            if(mx == lstd)break;
            lstd = mx;
        }

        lstd++;
        pl = lstd;
        k++;
    }

    return k;
}


Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 1ms
memory: 3884kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
5
9
6
5

result:

ok 5 lines

Test #2:

score: 11
Accepted
time: 0ms
memory: 3648kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
5
8
6
5

result:

ok 5 lines

Test #3:

score: 11
Accepted
time: 0ms
memory: 3592kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
6
8
6
3

result:

ok 5 lines

Test #4:

score: 11
Accepted
time: 0ms
memory: 3644kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
5
6
4
5

result:

ok 5 lines

Test #5:

score: 11
Accepted
time: 0ms
memory: 3648kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
5
9
6
2

result:

ok 5 lines

Test #6:

score: 11
Accepted
time: 0ms
memory: 3876kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
5
7
5
5

result:

ok 5 lines

Test #7:

score: 11
Accepted
time: 1ms
memory: 3656kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
6
8
6
3

result:

ok 5 lines

Test #8:

score: 11
Accepted
time: 1ms
memory: 3880kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
5
9
5
5

result:

ok 5 lines

Subtask #2:

score: 14
Accepted

Dependency #1:

100%
Accepted

Test #9:

score: 14
Accepted
time: 1ms
memory: 3808kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
4
7 5
0 0 2 2 3 1
4 5 6 3 1 2
4 5 6 1 3 2
4 5 6 3 1 2
4 5 6 3 1 2
4 5 6 3 1 2
10 5
0 1 1 2 4 5 0 2 0
9 6 5 7 8 4 3 1 2
9 6 7 5 4 8 1 2 3
6 9 7 5 4 8 2 1 3
6 9 7 5 4 2 1 8 3
6 9 7 5 4 2 1 8 3
7 5
0 0 0 3 1 4
6 5 4 1 3 2
5 6 1 4 3 2
5 6 1 3 4 2
5 1 6 4 2 3
5 1 4 2 6 3
...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
5
3
1
1

result:

ok 5 lines

Test #10:

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

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
4
7 5
0 0 1 0 0 5
2 6 4 3 1 5
2 6 5 4 1 3
2 6 1 5 3 4
2 6 5 4 3 1
2 6 3 1 5 4
10 5
0 0 2 0 4 4 0 7 5
1 6 3 2 8 9 5 4 7
3 6 1 2 5 8 9 7 4
1 3 6 2 8 5 9 7 4
6 3 1 2 9 5 8 7 4
3 6 1 2 9 8 5 4 7
7 5
0 1 0 1 1 0
4 2 6 3 5 1
4 2 6 3 1 5
4 6 2 3 1 5
2 4 6 3 5 1
6 4 2 3 1 5
...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
3
4
3
2

result:

ok 5 lines

Test #11:

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

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
4
7 5
0 1 1 2 3 4
6 5 4 2 1 3
6 5 4 2 1 3
6 5 4 2 3 1
6 5 4 2 1 3
6 4 5 2 3 1
10 5
0 0 2 3 3 4 6 6 8
1 9 7 5 6 8 3 2 4
9 1 7 5 8 6 2 4 3
1 7 9 8 6 2 5 3 4
1 9 8 7 6 2 5 3 4
9 8 7 1 6 5 3 4 2
7 5
0 1 2 2 4 5
3 5 6 4 2 1
5 3 6 4 2 1
5 6 4 3 2 1
5 4 6 3 1 2
5 6 4 3 1 2
...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
4
1
2
1

result:

ok 5 lines

Test #12:

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

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
4
7 5
0 1 1 2 4 4
6 5 4 3 2 1
5 6 4 3 1 2
5 6 4 3 2 1
6 5 4 3 1 2
5 6 4 3 2 1
10 5
0 0 2 3 3 5 5 6 8
7 9 4 1 8 6 5 3 2
7 9 4 1 8 6 5 3 2
7 9 4 1 8 6 5 3 2
7 9 4 1 6 8 5 3 2
7 9 4 1 8 6 5 3 2
7 5
0 1 1 2 3 4
5 6 4 2 3 1
5 6 2 4 3 1
5 6 4 2 3 1
5 6 4 2 3 1
5 6 2 4 3 1
...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
4
8
5
5

result:

ok 5 lines

Test #13:

score: 14
Accepted
time: 0ms
memory: 3876kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
4
7 5
0 0 2 2 1 0
3 5 6 4 1 2
5 3 4 6 1 2
5 3 4 6 2 1
3 5 6 4 1 2
3 5 4 6 2 1
10 5
0 0 2 3 4 0 3 6 8
7 5 9 4 6 8 3 2 1
5 7 9 4 6 8 3 1 2
7 9 5 4 8 6 3 1 2
7 5 9 4 8 6 3 2 1
7 5 9 4 8 6 3 1 2
7 5
0 0 1 2 0 5
6 5 3 2 4 1
6 3 2 4 1 5
6 2 4 1 5 3
6 2 4 5 3 1
6 2 4 3 1 5
...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
3
5
2
4

result:

ok 5 lines

Test #14:

score: 14
Accepted
time: 1ms
memory: 3536kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
4
7 5
0 0 2 3 2 2
5 6 4 1 3 2
5 6 4 1 3 2
6 5 4 1 3 2
5 6 4 1 3 2
5 6 4 1 3 2
10 5
0 1 0 2 3 2 2 5 8
9 4 8 7 5 3 2 6 1
9 4 5 3 8 7 2 6 1
9 4 3 7 5 8 6 2 1
9 7 3 5 8 4 2 6 1
9 8 7 3 4 5 2 6 1
7 5
0 0 1 1 1 3
6 5 3 2 1 4
6 5 2 3 1 4
6 5 3 2 1 4
5 6 4 2 3 1
5 6 1 2 3 4
...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
5
4
2
4

result:

ok 5 lines

Test #15:

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

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
4
7 5
0 1 1 2 4 5
6 5 4 2 1 3
6 5 4 2 3 1
5 6 4 2 1 3
6 5 4 2 1 3
5 6 4 2 1 3
10 5
0 1 1 3 4 4 5 6 8
9 7 2 8 5 6 4 3 1
9 7 2 8 5 6 3 4 1
7 9 8 2 5 6 3 4 1
9 7 8 2 5 6 4 3 1
7 9 2 8 5 6 4 3 1
7 5
0 0 1 3 4 5
2 5 4 6 1 3
5 4 2 1 6 3
5 4 2 6 1 3
5 2 4 6 1 3
5 4 6 2 3 1
...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
4
6
1
3

result:

ok 5 lines

Test #16:

score: 14
Accepted
time: 0ms
memory: 3592kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
4
7 5
0 0 1 2 3 5
3 4 5 2 6 1
5 3 1 4 2 6
5 6 2 3 1 4
4 2 1 6 3 5
1 2 6 3 5 4
10 5
0 1 2 3 4 4 5 7 8
7 9 6 5 8 4 3 2 1
9 7 5 6 8 4 2 3 1
9 5 6 8 7 4 2 3 1
8 7 9 6 5 4 2 3 1
6 8 5 7 9 4 1 3 2
7 5
0 0 1 3 3 5
4 6 5 3 1 2
4 6 5 3 1 2
6 4 3 5 1 2
6 4 5 3 1 2
4 6 3 5 1 2
...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
1
3
4
1

result:

ok 5 lines

Subtask #3:

score: 5
Accepted

Test #17:

score: 5
Accepted
time: 1ms
memory: 3688kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 1
0 1 2 3 4 5 6 7 8
9 8 7 6 5 4 3 2 1
10 1
0 1 2 3 4 5 6 7 8
9 7 8 5 6 4 3 2 1
10 1
0 1 2 3 4 5 6 7 8
8 9 7 5 6 3 2 4 1
10 1
0 1 2 3 4 5 6 7 8
8 9 6 7 5 4 3 2 1
10 1
0 1 2 3 4 5 6 7 8
8 9 7 5 6 3 4 2 1
10 1
0 1 2 3 4 5 6 7 8
9 8 7 6 5 4 2 3 1
10 1
0 1 2 3 4 5 6...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
9
7
5
7
6
8
6
8
7
6
4
5
8
6
9
7
7
6
8
7
30
29
24
20
22
59
567
58
33
25
30
37
34
7
3
8
4
8
7
6
4
5
7
6
6
8
4
6
5
7
6
9
6

result:

ok 54 lines

Test #18:

score: 5
Accepted
time: 1ms
memory: 3736kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 1
0 1 2 3 4 5 6 7 8
9 8 7 6 5 4 2 3 1
10 1
0 1 2 3 4 5 6 7 8
8 9 7 6 5 4 3 2 1
10 1
0 1 2 3 4 5 6 7 8
8 9 5 7 6 3 1 2 4
10 1
0 1 2 3 4 5 6 7 8
9 7 8 6 5 4 3 1 2
10 1
0 1 2 3 4 5 6 7 8
8 9 7 6 5 4 3 2 1
10 1
0 1 2 3 4 5 6 7 8
9 8 6 7 3 4 5 1 2
10 1
0 1 2 3 4 5 6...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
8
8
3
7
8
5
4
3
7
7
8
6
9
5
3
8
3
1
6
4
35
34
25
9
30
2
309
61
9
21
32
8
31
5
6
8
8
8
7
7
8
8
2
7
7
6
2
7
7
2
3
5
8

result:

ok 54 lines

Test #19:

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

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 1
0 1 2 3 4 5 6 7 8
9 8 7 6 5 4 2 3 1
10 1
0 1 2 3 4 5 6 7 8
9 7 6 8 4 3 2 1 5
10 1
0 1 2 3 4 5 6 7 8
9 8 7 6 5 4 3 2 1
10 1
0 1 2 3 4 5 6 7 8
9 8 6 7 5 3 4 2 1
10 1
0 1 2 3 4 5 6 7 8
9 7 8 5 6 4 3 2 1
10 1
0 1 2 3 4 5 6 7 8
9 8 7 6 5 4 3 2 1
10 1
0 1 2 3 4 5 6...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
8
3
9
7
7
9
6
4
5
6
5
7
6
8
7
7
6
7
7
5
19
23
33
38
27
75
833
80
21
30
34
17
30
6
3
7
7
6
8
5
4
9
7
7
7
8
4
8
6
6
8
8
8

result:

ok 54 lines

Test #20:

score: 5
Accepted
time: 1ms
memory: 3796kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 1
0 1 2 3 4 5 6 7 8
9 8 6 7 2 5 3 1 4
10 1
0 1 2 3 4 5 6 7 8
5 7 9 2 6 4 3 1 8
10 1
0 1 2 3 4 5 6 7 8
9 7 8 6 5 4 3 2 1
10 1
0 1 2 3 4 5 6 7 8
8 9 7 6 5 4 2 3 1
10 1
0 1 2 3 4 5 6 7 8
7 8 6 5 4 1 3 9 2
10 1
0 1 2 3 4 5 6 7 8
8 9 7 6 4 5 3 2 1
10 1
0 1 2 3 4 5 6...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
4
1
8
7
1
7
5
3
5
1
7
4
4
7
9
2
6
4
8
4
6
8
22
23
30
78
852
78
32
29
28
13
34
7
8
7
7
8
3
3
7
9
7
5
9
8
6
8
7
9
8
8
9

result:

ok 54 lines

Subtask #4:

score: 9
Accepted

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Test #21:

score: 9
Accepted
time: 1ms
memory: 3728kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 1
0 0 1 0 4 2 6 4 5
8 9 5 7 3 4 1 6 2
10 1
0 1 2 0 3 1 6 5 2
4 9 8 5 7 3 6 2 1
10 1
0 0 2 0 0 4 6 0 6
8 7 5 1 2 3 9 6 4
10 1
0 1 2 2 2 1 3 0 4
8 5 6 7 4 3 9 2 1
10 1
0 0 0 0 3 5 6 0 5
1 9 4 8 7 2 6 3 5
10 1
0 1 2 1 0 1 3 5 1
4 7 6 3 8 5 2 9 1
10 1
0 0 2 2 3 0 3...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
9
9
8
7
8
9
9
9
9
9
8
7
8
9
9
9
9
5
8
9
38
38
38
38
37
89
998
99
39
38
38
39
37
8
9
5
6
9
9
8
9
9
8
9
8
5
7
8
8
9
9
8
9

result:

ok 54 lines

Test #22:

score: 9
Accepted
time: 1ms
memory: 3924kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 1
0 0 0 0 2 2 4 4 6
7 5 3 8 9 4 6 2 1
10 1
0 1 0 1 0 1 4 3 5
9 2 8 5 4 7 3 1 6
10 1
0 1 2 3 1 5 3 1 5
9 4 6 8 5 7 2 3 1
10 1
0 0 1 3 4 3 2 4 4
8 6 7 5 9 2 4 3 1
10 1
0 1 0 1 3 2 3 6 7
1 3 8 2 9 7 5 4 6
10 1
0 1 2 3 0 3 6 0 5
4 8 7 5 9 6 3 1 2
10 1
0 1 1 2 3 2 1...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
9
7
8
9
1
7
1
9
6
8
6
9
9
4
9
7
9
3
8
9
32
39
38
35
38
88
996
98
39
23
38
38
39
6
1
7
7
9
7
6
6
1
4
9
6
3
9
4
9
7
8
9
5

result:

ok 54 lines

Test #23:

score: 9
Accepted
time: 1ms
memory: 3716kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 1
0 1 1 3 4 4 5 7 7
2 8 6 9 7 4 5 1 3
10 1
0 1 1 2 3 4 5 6 8
5 7 3 9 8 4 2 6 1
10 1
0 1 2 3 3 5 6 7 7
9 4 8 7 6 5 2 3 1
10 1
0 0 2 2 3 4 6 7 8
1 5 9 8 7 6 3 4 2
10 1
0 0 2 2 4 5 6 6 8
3 9 1 7 8 6 5 4 2
10 1
0 0 1 3 3 4 6 6 7
2 9 8 5 7 4 6 3 1
10 1
0 0 2 3 4 5 6...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
7
6
8
9
9
8
7
6
9
8
6
8
7
7
6
7
7
8
9
9
35
34
36
32
32
95
957
93
30
32
30
34
36
4
7
7
8
6
8
8
7
9
8
7
8
8
9
8
9
8
8
8
8

result:

ok 54 lines

Test #24:

score: 9
Accepted
time: 1ms
memory: 3744kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 1
0 1 1 2 3 4 6 6 7
9 5 8 7 3 4 6 2 1
10 1
0 0 1 3 4 5 6 6 7
2 8 6 9 7 5 3 4 1
10 1
0 0 1 2 4 4 6 7 7
6 9 1 4 8 5 3 2 7
10 1
0 0 2 2 4 5 5 7 8
7 4 3 5 2 9 1 8 6
10 1
0 0 2 2 3 4 6 7 7
1 6 2 7 5 3 4 9 8
10 1
0 1 2 2 4 4 6 6 8
7 3 5 9 8 6 4 1 2
10 1
0 0 2 2 4 5 6...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
8
6
1
1
2
8
6
8
5
6
7
6
9
4
7
9
1
8
8
7
36
37
36
34
32
33
863
90
38
31
37
37
31
9
7
5
6
8
4
8
4
8
9
8
5
9
2
7
6
4
8
7
7

result:

ok 54 lines

Test #25:

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

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 1
0 0 2 1 3 5 5 4 1
6 7 5 8 2 3 9 1 4
10 1
0 1 0 3 0 2 6 5 5
9 7 8 6 2 5 4 1 3
10 1
0 0 1 2 2 1 1 6 3
8 9 5 7 6 3 4 2 1
10 1
0 0 1 3 4 2 0 5 5
8 7 6 2 5 4 3 9 1
10 1
0 0 1 3 2 1 0 5 7
9 7 8 6 3 4 1 5 2
10 1
0 0 0 0 2 5 0 0 7
6 3 9 8 1 5 4 2 7
10 1
0 0 0 0 2 0 6...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
7
9
9
6
8
9
9
8
9
8
8
9
9
9
9
7
9
8
9
9
36
38
37
39
37
93
998
97
38
38
39
39
39
8
9
9
7
8
9
6
5
7
9
8
8
9
9
8
9
8
8
9
8

result:

ok 54 lines

Test #26:

score: 9
Accepted
time: 0ms
memory: 3964kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 1
0 0 0 1 1 1 4 2 3
5 7 9 3 8 4 2 1 6
10 1
0 0 1 1 1 1 3 2 6
7 1 4 9 6 3 2 5 8
10 1
0 0 2 2 2 2 3 0 7
1 6 4 9 8 7 3 5 2
10 1
0 0 2 1 3 5 6 6 1
4 6 8 7 9 5 3 1 2
10 1
0 0 1 3 3 1 1 2 1
6 5 4 7 8 9 3 1 2
10 1
0 1 0 1 4 5 3 2 7
9 8 2 7 6 4 5 3 1
10 1
0 1 1 1 3 4 3...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
8
2
9
7
9
8
9
6
9
8
8
9
9
9
3
6
9
9
9
7
39
27
36
36
36
99
37
97
38
36
36
36
26
9
9
8
9
8
9
8
7
9
5
8
7
9
6
7
9
7
9
8
2

result:

ok 54 lines

Test #27:

score: 9
Accepted
time: 1ms
memory: 3712kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 1
0 1 1 3 4 4 6 6 7
5 8 7 9 6 4 3 2 1
10 1
0 1 2 3 4 4 5 7 7
8 6 9 7 4 5 3 2 1
10 1
0 1 2 3 3 4 6 7 7
5 9 7 6 4 3 8 1 2
10 1
0 1 1 3 4 5 5 7 7
2 8 6 9 5 7 4 3 1
10 1
0 0 2 2 3 5 6 6 8
4 1 7 9 8 6 5 3 2
10 1
0 1 1 3 4 5 6 6 8
7 9 2 8 6 5 3 4 1
10 1
0 0 1 3 3 4 6...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
8
8
4
8
9
8
7
9
7
9
5
9
5
7
8
9
9
9
7
9
37
38
36
33
32
86
917
82
36
37
38
35
37
7
9
8
9
9
9
6
8
7
5
7
8
7
7
8
7
6
9
8
6

result:

ok 54 lines

Test #28:

score: 9
Accepted
time: 1ms
memory: 3736kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 1
0 0 2 3 4 4 5 7 8
1 9 6 8 5 7 3 4 2
10 1
0 0 2 3 4 4 6 7 8
1 9 5 8 7 4 6 3 2
10 1
0 0 1 3 3 5 5 7 8
6 2 9 7 8 5 3 4 1
10 1
0 1 2 2 3 4 5 6 7
7 9 8 6 4 5 3 2 1
10 1
0 0 1 3 4 5 6 6 8
2 7 9 8 6 5 4 3 1
10 1
0 1 1 2 4 4 5 7 7
6 9 8 3 7 5 4 2 1
10 1
0 0 1 2 4 4 6...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
7
8
7
8
9
9
3
8
9
9
8
8
9
8
5
4
8
9
6
6
21
35
37
36
27
47
900
94
20
1
35
29
25
1
7
9
4
6
8
9
9
7
6
6
5
6
8
7
6
4
2
8
8

result:

ok 54 lines

Subtask #5:

score: 5
Accepted

Dependency #3:

100%
Accepted

Test #29:

score: 5
Accepted
time: 1ms
memory: 3852kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 5
0 1 2 3 4 5 6 7 8
9 7 6 8 5 3 4 1 2
9 7 6 8 5 4 3 1 2
9 7 6 8 5 3 4 1 2
9 6 8 7 5 3 4 2 1
9 6 8 7 5 4 3 2 1
10 5
0 1 2 3 4 5 6 7 8
9 8 7 6 5 4 3 2 1
9 8 7 5 4 6 3 1 2
9 8 7 5 6 4 3 2 1
9 8 7 5 6 4 3 1 2
9 8 7 6 4 5 3 2 1
10 5
0 1 2 3 4 5 6 7 8
8 9 7 5 6 4 2 3...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
5
6
4
5
5
7
7
6
1
6
4
4
4
5
6
5
5
5
2
5
2
30
25
31
2
71
619
33
29
15
27
21
23
6
6
4
7
8
3
6
4
4
4
7
4
2
5
4
1
7
7
5
6

result:

ok 54 lines

Test #30:

score: 5
Accepted
time: 1ms
memory: 3856kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 5
0 1 2 3 4 5 6 7 8
9 8 7 6 5 4 3 1 2
9 8 6 7 5 4 3 2 1
9 8 7 6 4 5 3 1 2
9 8 6 7 4 5 3 1 2
9 8 6 7 4 5 3 1 2
10 5
0 1 2 3 4 5 6 7 8
9 7 6 8 5 4 3 2 1
8 9 7 6 5 4 3 1 2
8 7 6 9 5 4 3 1 2
7 8 6 9 5 4 3 1 2
8 7 9 6 5 4 3 1 2
10 5
0 1 2 3 4 5 6 7 8
8 9 7 5 6 4 3 1...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
6
5
4
1
1
3
6
3
4
5
2
7
7
2
2
9
5
6
6
1
23
18
8
30
26
68
684
24
26
28
16
31
24
7
8
7
5
5
2
9
2
3
2
3
7
4
7
2
6
3
4
2
5

result:

ok 54 lines

Test #31:

score: 5
Accepted
time: 1ms
memory: 3828kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 5
0 1 2 3 4 5 6 7 8
9 8 7 6 5 4 2 3 1
8 9 7 6 4 5 3 2 1
8 9 7 6 5 4 3 2 1
9 8 7 6 5 4 3 2 1
9 8 7 6 4 5 2 3 1
10 5
0 1 2 3 4 5 6 7 8
9 8 7 6 5 4 3 1 2
8 7 9 5 6 4 3 2 1
7 8 9 5 6 4 3 2 1
7 8 9 6 5 4 3 2 1
8 7 9 5 6 4 3 2 1
10 5
0 1 2 3 4 5 6 7 8
9 8 7 5 6 4 2 1...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
6
5
3
8
4
1
5
2
6
7
4
1
2
3
5
6
4
6
2
5
27
7
14
26
29
68
721
69
29
28
20
18
20
6
6
6
6
5
1
8
6
5
2
8
5
4
2
7
8
6
4
5
3

result:

ok 54 lines

Test #32:

score: 5
Accepted
time: 1ms
memory: 3792kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 5
0 1 2 3 4 5 6 7 8
9 8 7 5 6 4 3 1 2
9 8 5 6 7 4 3 2 1
9 5 7 6 8 4 3 2 1
9 6 8 5 7 4 3 2 1
9 6 8 5 7 4 3 1 2
10 5
0 1 2 3 4 5 6 7 8
7 8 6 5 4 1 3 9 2
8 4 3 5 2 9 6 1 7
8 3 1 7 6 9 2 4 5
8 2 1 4 7 5 6 3 9
1 3 2 8 9 5 7 4 6
10 5
0 1 2 3 4 5 6 7 8
9 8 7 6 5 4 3 2...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
5
1
9
6
6
2
6
2
4
7
5
6
6
4
3
3
7
5
6
7
3
9
7
8
5
51
698
47
6
6
10
28
24
5
1
5
4
6
3
3
2
6
3
6
1
7
5
3
6
4
4
1
5

result:

ok 54 lines

Subtask #6:

score: 11
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #33:

score: 11
Accepted
time: 1ms
memory: 3792kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 5
0 0 1 2 2 1 2 6 2
3 4 9 8 6 5 7 1 2
3 4 9 8 6 5 7 1 2
3 4 9 8 6 5 7 1 2
3 4 9 8 6 5 7 1 2
3 4 9 8 6 5 7 1 2
10 5
0 1 1 3 2 3 5 3 0
8 7 4 5 6 2 3 9 1
8 4 7 6 5 2 3 9 1
8 7 4 6 5 3 2 9 1
8 4 7 6 5 2 3 9 1
8 7 4 5 6 3 2 9 1
10 5
0 0 0 0 1 0 1 4 3
9 6 7 3 4 8 5 2...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
9
6
6
3
2
6
6
6
6
4
5
6
7
3
1
3
2
4
6
7
26
21
32
7
9
7
592
16
10
21
16
14
26
4
6
1
5
6
7
4
6
2
7
1
3
9
6
1
2
6
5
4
2

result:

ok 54 lines

Test #34:

score: 11
Accepted
time: 1ms
memory: 3784kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 5
0 0 2 2 2 0 5 5 4
8 7 6 3 9 4 1 2 5
6 8 3 7 9 4 1 2 5
3 4 6 8 7 9 1 5 2
6 4 9 8 7 3 1 5 2
4 7 3 9 8 6 1 5 2
10 5
0 1 2 3 4 3 0 7 1
5 9 6 3 7 2 4 8 1
5 6 9 7 3 8 1 2 4
5 6 9 7 1 3 2 8 4
6 9 5 3 1 7 4 2 8
6 5 9 8 3 2 7 4 1
10 5
0 0 0 2 3 0 2 6 5
9 1 4 7 5 8 2 3...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
3
2
5
6
2
7
4
7
1
2
2
4
3
8
1
7
2
3
6
7
21
21
31
24
22
70
725
56
17
23
22
27
21
3
7
8
5
1
5
5
5
7
2
8
3
4
3
7
4
6
2
1
3

result:

ok 54 lines

Test #35:

score: 11
Accepted
time: 1ms
memory: 3752kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 5
0 1 1 2 4 4 6 6 8
7 9 3 8 5 4 6 1 2
7 9 3 5 8 6 4 2 1
7 9 3 8 5 4 6 2 1
7 9 3 5 8 6 4 2 1
7 9 3 5 8 6 4 1 2
10 5
0 1 1 2 4 5 5 7 8
9 3 6 8 7 5 4 2 1
9 6 3 8 7 5 4 2 1
9 3 6 8 5 7 4 1 2
9 3 6 8 7 5 4 1 2
9 3 6 8 7 5 4 2 1
10 5
0 1 1 3 4 4 5 7 7
2 6 9 8 7 5 4 3...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
6
6
4
5
6
6
3
8
4
3
8
2
6
3
5
7
4
4
5
6
13
7
32
32
20
9
582
27
30
25
9
27
18
2
2
7
7
7
2
5
4
6
1
6
5
6
7
3
3
6
2
5
4

result:

ok 54 lines

Test #36:

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

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 5
0 1 2 2 4 5 6 6 7
3 8 9 6 7 5 4 1 2
3 9 8 7 6 5 4 2 1
9 3 8 7 6 5 4 2 1
8 3 9 7 6 5 4 2 1
8 3 9 7 6 5 4 1 2
10 5
0 0 1 2 3 5 5 6 7
9 4 7 8 6 2 5 1 3
9 4 7 8 2 6 5 3 1
9 4 7 8 6 2 5 1 3
9 4 7 8 6 2 5 3 1
9 4 7 8 2 6 5 3 1
10 5
0 1 2 3 3 4 5 6 7
8 9 7 6 5 3 4 2...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
5
7
7
1
7
4
8
6
3
6
2
3
3
4
3
6
2
3
1
6
4
18
8
8
28
1
297
48
27
31
29
23
24
7
4
1
3
5
2
2
5
8
3
5
1
2
8
4
4
5
2
6
4

result:

ok 54 lines

Test #37:

score: 11
Accepted
time: 1ms
memory: 3728kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 5
0 0 1 0 0 4 1 3 6
7 2 5 9 6 8 4 1 3
7 2 9 5 6 8 1 4 3
2 7 5 9 8 6 1 3 4
7 2 9 5 6 8 1 4 3
7 2 5 9 8 6 1 3 4
10 5
0 1 2 2 0 0 0 4 5
8 7 9 4 6 5 3 1 2
8 7 9 6 4 5 3 2 1
8 7 9 4 6 5 3 2 1
8 7 9 4 6 5 2 1 3
8 7 9 6 4 5 2 3 1
10 5
0 0 2 1 4 2 0 0 8
5 7 3 6 8 9 1 4...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
4
6
5
5
4
3
8
4
5
7
5
6
5
8
9
2
5
7
2
5
19
24
3
13
18
54
739
41
18
12
16
19
19
6
1
2
5
8
6
3
2
6
7
3
4
4
1
6
5
3
1
2
3

result:

ok 54 lines

Test #38:

score: 11
Accepted
time: 1ms
memory: 3720kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 5
0 1 1 0 0 4 0 7 3
5 6 4 2 9 3 1 8 7
6 5 4 2 9 3 8 1 7
6 5 4 2 9 3 1 8 7
5 6 4 2 9 3 8 1 7
6 5 4 2 9 3 1 8 7
10 5
0 1 2 1 2 5 1 6 2
4 8 6 9 5 7 3 2 1
4 8 6 9 5 7 3 2 1
4 8 6 9 7 5 3 2 1
8 4 6 9 7 5 3 1 2
4 8 6 9 7 5 3 2 1
10 5
0 1 1 0 0 5 2 3 4
7 9 2 6 8 3 5 4...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
7
6
7
7
5
3
5
4
6
5
4
5
2
7
8
6
2
4
5
8
11
3
14
27
10
34
674
6
17
8
13
13
5
4
4
6
5
6
6
4
7
1
3
1
7
3
7
7
4
1
7
8
1

result:

ok 54 lines

Test #39:

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

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 5
0 0 2 3 4 4 5 7 8
1 6 9 8 5 7 4 3 2
1 6 9 8 7 5 4 3 2
1 6 9 8 7 5 4 3 2
1 6 9 8 5 7 4 3 2
1 6 9 8 5 7 4 3 2
10 5
0 1 2 2 3 4 6 6 7
8 5 3 9 7 6 4 2 1
8 5 3 9 6 7 4 2 1
8 5 3 9 6 7 4 2 1
8 5 3 9 7 6 4 2 1
8 5 3 9 7 6 4 2 1
10 5
0 0 1 2 3 5 6 7 7
4 8 2 9 7 6 5 3...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
8
8
9
6
5
4
8
8
5
7
3
7
3
7
2
2
8
4
7
2
7
17
18
12
29
71
432
43
31
11
14
20
23
2
4
4
2
2
7
6
4
2
5
3
5
5
4
5
2
7
6
1
6

result:

ok 54 lines

Test #40:

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

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 5
0 0 1 3 4 5 5 7 7
2 6 9 8 5 7 4 3 1
2 9 6 8 7 5 4 3 1
2 6 9 7 5 8 4 3 1
2 9 6 7 5 8 4 3 1
2 9 6 7 8 5 4 3 1
10 5
0 1 2 3 4 4 5 6 7
9 6 7 8 3 4 5 2 1
8 9 6 7 2 3 4 1 5
8 9 7 6 4 1 5 3 2
8 7 9 6 1 4 2 3 5
6 7 8 9 1 3 4 5 2
10 5
0 1 2 2 3 4 5 7 8
6 4 8 9 7 5 3 1...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
6
2
6
8
2
2
2
5
8
4
6
5
4
3
3
7
7
2
2
1
17
28
19
8
16
69
586
77
13
3
22
27
17
2
6
2
6
5
6
3
6
2
5
3
4
2
7
5
5
8
7
7
2

result:

ok 54 lines

Subtask #7:

score: 9
Accepted

Dependency #3:

100%
Accepted

Test #41:

score: 9
Accepted
time: 111ms
memory: 18448kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
37
42
32
34
38
33
30
42
43
29
28
29
42
37
42
30
30
30
29
30
35
34
29
33
28
37
41
29
35
35
32
40
45
36
30
31
38
42
42
34
37
23
33
43
36
37
36
20
33
30
38
41
38
38
32
39
42
31
34
30
32
41
40
30
23
40
40
45
41
37
40
36
42
33
27
34
35
36
32
31
34
37
36
39
46
42
42
39
25
...

result:

ok 2226 lines

Test #42:

score: 9
Accepted
time: 105ms
memory: 18476kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
42
41
40
36
17
35
12
39
29
41
41
34
20
33
42
36
20
36
41
25
18
37
29
15
17
11
6
39
35
7
34
37
42
40
39
44
1
3
29
39
42
20
35
42
18
39
31
26
26
35
28
7
4
42
13
24
39
19
27
40
26
14
1
39
19
44
1
6
13
38
12
6
39
38
29
40
47
38
36
43
42
43
41
20
41
6
21
44
43
37
14
44
25...

result:

ok 2226 lines

Test #43:

score: 9
Accepted
time: 114ms
memory: 18388kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
39
37
38
34
25
31
23
43
34
39
41
34
26
28
27
33
42
42
39
36
40
34
29
34
27
42
43
22
24
35
31
37
27
29
42
29
40
44
27
41
38
27
28
41
31
35
39
32
42
44
39
39
35
38
39
34
33
31
21
39
34
37
40
43
35
40
31
32
45
29
36
34
37
41
33
46
35
36
43
32
28
40
28
33
34
42
43
28
38
...

result:

ok 2226 lines

Test #44:

score: 9
Accepted
time: 103ms
memory: 18440kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
35
24
38
37
15
33
30
3
35
42
3
44
40
28
41
29
13
38
15
21
29
36
15
40
25
22
42
7
31
39
40
37
26
39
8
25
22
44
28
36
3
13
5
7
13
17
42
45
36
41
36
10
15
40
7
5
40
26
44
27
34
23
40
19
31
21
36
1
33
33
26
25
26
39
37
24
46
37
14
36
28
8
42
23
38
35
41
44
31
42
22
10
36...

result:

ok 2226 lines

Subtask #8:

score: 11
Accepted

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #7:

100%
Accepted

Test #45:

score: 11
Accepted
time: 149ms
memory: 10368kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
43
48
46
48
44
46
47
48
47
48
45
46
47
45
48
47
48
48
47
48
46
44
49
47
47
48
43
46
46
46
49
47
44
46
49
48
48
45
45
48
45
41
47
47
48
49
49
48
49
48
49
49
45
49
42
49
48
47
49
49
49
46
49
48
45
48
49
47
48
47
49
49
40
49
46
46
49
47
49
47
47
45
49
47
47
46
44
46
48
...

result:

ok 2226 lines

Test #46:

score: 11
Accepted
time: 127ms
memory: 10784kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
49
46
44
49
48
45
48
45
48
44
37
49
49
48
46
45
45
2
49
31
49
46
47
12
19
41
25
44
38
49
1
29
49
48
44
44
49
49
46
38
46
40
38
48
47
45
49
49
43
37
48
49
48
43
12
29
49
45
47
26
46
49
46
47
45
49
42
47
49
45
47
34
48
49
48
49
49
41
47
39
26
46
36
49
47
39
21
49
44
18...

result:

ok 2226 lines

Test #47:

score: 11
Accepted
time: 128ms
memory: 11360kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
38
43
47
38
36
45
47
47
39
40
43
42
43
44
45
45
45
38
45
48
43
37
43
43
41
42
38
48
40
39
37
41
46
37
47
49
47
41
46
48
47
36
45
41
41
34
36
43
45
43
44
44
44
43
45
46
39
39
30
40
44
41
43
39
42
42
42
45
46
46
37
40
45
39
38
40
43
48
47
40
42
38
45
45
43
35
40
41
45
...

result:

ok 2226 lines

Test #48:

score: 11
Accepted
time: 141ms
memory: 11364kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
41
47
27
46
47
32
45
2
45
44
45
1
33
45
44
44
19
46
42
34
36
1
44
1
44
38
47
43
41
43
39
34
43
42
41
39
43
33
45
41
41
43
44
2
46
45
42
42
38
29
19
1
41
32
43
43
41
45
32
48
28
42
27
35
48
46
38
42
44
18
25
32
33
28
47
34
23
31
47
31
47
42
40
43
40
35
6
37
40
42
36
4...

result:

ok 2226 lines

Test #49:

score: 11
Accepted
time: 125ms
memory: 10372kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
49
46
46
48
49
49
48
46
47
46
49
48
47
49
47
46
43
47
47
47
49
46
47
47
46
43
47
47
47
46
48
48
44
48
46
48
48
49
47
49
45
47
47
48
48
49
47
48
44
48
48
47
47
48
49
48
43
49
46
43
47
49
49
47
47
48
48
48
48
48
49
49
46
49
47
47
49
47
49
48
48
49
47
49
48
49
48
47
46
...

result:

ok 2226 lines

Test #50:

score: 11
Accepted
time: 139ms
memory: 10928kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
25
49
48
27
47
45
47
45
44
41
34
46
39
45
24
35
15
46
44
44
25
48
48
46
49
7
48
47
45
47
47
48
46
49
18
48
15
48
49
47
48
49
49
45
48
46
47
49
41
44
45
40
43
47
1
49
45
46
48
49
49
45
41
45
49
47
39
47
47
47
36
41
44
46
45
39
34
46
45
47
45
45
4
46
43
44
3
48
37
40
4...

result:

ok 2226 lines

Test #51:

score: 11
Accepted
time: 116ms
memory: 11016kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
40
37
37
39
43
39
46
45
43
46
47
44
40
33
47
46
45
45
36
42
44
43
42
44
45
41
44
43
48
37
40
36
45
35
43
43
40
44
37
45
45
46
43
42
39
46
46
46
39
40
45
40
43
42
35
44
45
45
42
45
47
42
40
36
45
41
43
48
44
47
33
43
39
43
40
47
44
40
40
49
47
36
42
42
45
41
41
46
44
...

result:

ok 2226 lines

Test #52:

score: 11
Accepted
time: 115ms
memory: 11312kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
46
43
41
43
35
46
47
44
40
37
43
38
47
24
46
28
43
44
43
45
42
46
39
43
46
17
45
29
46
49
49
38
45
43
44
33
18
35
38
32
45
46
37
47
39
14
40
43
35
46
39
31
43
30
44
44
35
41
45
20
46
17
46
34
44
38
46
36
45
42
43
36
41
48
46
30
42
40
35
37
45
42
36
29
43
48
28
19
45
...

result:

ok 2226 lines

Subtask #9:

score: 9
Accepted

Dependency #3:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #7:

100%
Accepted

Test #53:

score: 9
Accepted
time: 53ms
memory: 23788kb

input:

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

output:

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

result:

ok 446 lines

Test #54:

score: 9
Accepted
time: 57ms
memory: 23760kb

input:

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

output:

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

result:

ok 446 lines

Test #55:

score: 9
Accepted
time: 65ms
memory: 23892kb

input:

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

output:

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

result:

ok 446 lines

Test #56:

score: 9
Accepted
time: 60ms
memory: 23824kb

input:

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

output:

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

result:

ok 446 lines

Subtask #10:

score: 16
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Dependency #9:

100%
Accepted

Test #57:

score: 16
Accepted
time: 81ms
memory: 16420kb

input:

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

output:

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

result:

ok 446 lines

Test #58:

score: 16
Accepted
time: 80ms
memory: 16276kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
15
34
9
27
5
32
22
3
30
20
36
1
30
17
14
30
36
11
34
11
17
11
22
24
3
22
21
10
15
16
34
14
20
17
19
24
27
35
18
17
36
26
9
24
37
29
16
15
35
10
13
33
25
22
35
14
33
13
34
3
21
23
16
22
9
23
28
20
18
33
7
41
6
7
23
36
6
30
26
32
11
30
32
10
19
35
21
22
22
11
26
31
19
...

result:

ok 446 lines

Test #59:

score: 16
Accepted
time: 65ms
memory: 17280kb

input:

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

output:

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

result:

ok 446 lines

Test #60:

score: 16
Accepted
time: 63ms
memory: 17244kb

input:

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

output:

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

result:

ok 446 lines

Test #61:

score: 16
Accepted
time: 72ms
memory: 16272kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
17
31
9
12
11
11
16
9
12
22
20
29
30
26
34
15
21
20
25
10
10
6
15
13
17
16
16
22
9
36
29
13
5
35
34
33
25
27
39
23
25
16
11
10
5
33
15
14
36
6
10
5
31
24
29
29
15
4
11
5
36
20
26
4
16
18
16
25
27
35
35
5
6
34
24
11
10
3
35
17
27
15
28
26
35
36
38
35
34
31
22
4
23
17
...

result:

ok 446 lines

Test #62:

score: 16
Accepted
time: 75ms
memory: 16244kb

input:

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

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
26
34
33
33
30
33
33
23
8
1
31
38
18
15
22
14
10
2
12
15
32
27
9
28
19
25
35
19
23
32
19
14
38
35
28
24
36
31
37
6
27
6
25
32
22
38
33
24
26
28
14
5
5
7
25
24
12
6
22
31
29
18
25
33
30
20
12
8
37
31
31
33
31
5
33
26
22
34
32
30
37
29
10
39
28
40
7
22
27
31
33
37
8
15...

result:

ok 446 lines

Test #63:

score: 16
Accepted
time: 66ms
memory: 17396kb

input:

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

output:

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

result:

ok 446 lines

Test #64:

score: 16
Accepted
time: 63ms
memory: 17336kb

input:

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

output:

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

result:

ok 446 lines