QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#426146#8724. Septemberneilliu59 766ms30352kbC++142.4kb2024-05-30 21:38:112024-05-30 21:38:14

Judging History

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

  • [2024-05-30 21:38:14]
  • 评测
  • 测评结果:59
  • 用时:766ms
  • 内存:30352kb
  • [2024-05-30 21:38:11]
  • 提交

answer

#include <bits/stdc++.h>
#include "september.h"
using namespace std;
#define MAXN 100005
#define MAXM 6
int dep[MAXN];
vector<int> edge[MAXN];
int F[MAXN],S[MAXM][MAXN];
int sum[MAXM][MAXN];//xia mian you ji ge dian zai xu lie li
int status[MAXM][MAXN];//mu qian zhuang kuang
bool ok[MAXM][MAXN];
int nowin[MAXM][MAXN];
void dfs1(int now){//calcu dep
    dep[now] = 1;
    for(int i = 0; i < edge[now].size(); i++){
        if(edge[now][i] == F[now]) continue;
        dfs1(edge[now][i]);
        dep[now] += dep[edge[now][i]];
    }
}
int solve(int n,int m,vector<int> f,vector< vector<int> > s){
    for(int i = 1; i < n; i++) F[i] = f[i];
    for(int i = 0; i < m; i++){
        for(int j = 0; j < n-1; j++) S[i][j] = s[i][j];
    }
    memset(dep,0,sizeof(dep));
    memset(sum,0,sizeof(sum));
    memset(status,0,sizeof(status));
    memset(ok,0,sizeof(ok));
    memset(nowin,0,sizeof(nowin));
    for(int i = 0; i < n; i++) edge[i].clear();
    for(int i = 1; i < n; i++){
        edge[i].push_back(F[i]);
        edge[F[i]].push_back(i); 
    }
	dfs1(0);
    //for(int i = 1; i < n; i++) cout << dep[i] << " ";
    for(int i = 0; i < n-1; i++){//mei ju di i tian
        for(int j = 0; j < m; j++){
            int dian = S[j][i];
            while(1){
            	if(dian == 0) break;
                if(status[j][dian] == 0 && dian == S[j][i]) status[j][dian] = -1,status[j][n]--,sum[j][dian]++;
                if(sum[j][dian] == dep[dian]){
                    status[j][n] += (1 - status[j][dian]);
                    status[j][dian] = 1;
                    sum[j][F[dian]] += sum[j][dian];
                    dian = F[dian];
                }else break;
            }
            if(status[j][n] == i+1) ok[j][i] = 1;
            else ok[j][i] = 0;
        }
    }
    int ans = 0;
    for(int i = 0; i < n-1; i++){
        for(int j = 0; j < m; j++){
            //cout << status[j][i] << " " << ok[j][i] << endl;
            nowin[j][S[j][i]] = 1;
        }
        /*
        bool ok1 = 1;
        for(int j = 0; j < m; j++){
            int count = 0;
            for(int jj = 0; jj < m; jj++) count += nowin[jj][S[j][i]];
            if(count != m){
                ok1 = 0; break;
            }
        }
        if(ok1 == 0) continue;
        */
        int count = 0;
        for(int j = 0; j < m; j++) if(ok[j][i] == 1) count++;
        if(count == m) ans++; 
    }
    return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 2ms
memory: 16864kb

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: 0
Accepted
time: 0ms
memory: 16640kb

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: 0
Accepted
time: 0ms
memory: 16684kb

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: 0
Accepted
time: 5ms
memory: 16700kb

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: 0
Accepted
time: 0ms
memory: 16636kb

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: 0
Accepted
time: 0ms
memory: 16864kb

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: 0
Accepted
time: 0ms
memory: 14592kb

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: 0
Accepted
time: 0ms
memory: 16704kb

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: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #9:

score: 0
Wrong Answer
time: 0ms
memory: 16680kb

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
6
6
4
3

result:

wrong answer 2nd lines differ - expected: '5', found: '6'

Subtask #3:

score: 5
Accepted

Test #17:

score: 5
Accepted
time: 15ms
memory: 16752kb

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: 0
Accepted
time: 15ms
memory: 14644kb

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: 0
Accepted
time: 11ms
memory: 17008kb

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: 0
Accepted
time: 19ms
memory: 16808kb

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: 16ms
memory: 16688kb

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: 0
Accepted
time: 15ms
memory: 14696kb

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: 0
Accepted
time: 19ms
memory: 16740kb

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: 0
Accepted
time: 19ms
memory: 17004kb

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: 0
Accepted
time: 15ms
memory: 16988kb

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: 0
Accepted
time: 18ms
memory: 16952kb

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: 0
Accepted
time: 19ms
memory: 14696kb

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: 0
Accepted
time: 15ms
memory: 16708kb

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: 16ms
memory: 16732kb

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: 0
Accepted
time: 16ms
memory: 17080kb

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: 0
Accepted
time: 19ms
memory: 16852kb

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: 0
Accepted
time: 19ms
memory: 16792kb

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: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%

Subtask #7:

score: 9
Accepted

Dependency #3:

100%
Accepted

Test #41:

score: 9
Accepted
time: 723ms
memory: 27312kb

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: 0
Accepted
time: 738ms
memory: 27164kb

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: 0
Accepted
time: 731ms
memory: 27160kb

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: 0
Accepted
time: 747ms
memory: 27308kb

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: 759ms
memory: 22012kb

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: 0
Accepted
time: 766ms
memory: 21976kb

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: 0
Accepted
time: 739ms
memory: 22368kb

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: 0
Accepted
time: 737ms
memory: 22364kb

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: 0
Accepted
time: 753ms
memory: 21976kb

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: 0
Accepted
time: 750ms
memory: 22040kb

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: 0
Accepted
time: 728ms
memory: 22412kb

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: 0
Accepted
time: 744ms
memory: 22336kb

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: 182ms
memory: 30244kb

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: 0
Accepted
time: 180ms
memory: 30216kb

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: 0
Accepted
time: 185ms
memory: 30352kb

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: 0
Accepted
time: 182ms
memory: 30260kb

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: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%