QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#604943#8724. Septemberliuziao#30 6ms6012kbC++231.4kb2024-10-02 14:42:182024-10-02 14:42:20

Judging History

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

  • [2024-10-02 14:42:20]
  • 评测
  • 测评结果:30
  • 用时:6ms
  • 内存:6012kb
  • [2024-10-02 14:42:18]
  • 提交

answer

#include "september.h"
#include <bits/stdc++.h>

#ifdef ORZXKR
#include "stub.cpp"
#endif

const int kMaxN = 1e5 + 5;

int n, m, cnt;
int p[kMaxN], dfn[kMaxN], sz[kMaxN];
bool del[kMaxN];
std::vector<int> G[kMaxN];

void dfs(int u) {
  dfn[u] = ++cnt, sz[u] = 1;
  for (auto v : G[u]) {
    dfs(v);
    sz[u] += sz[v];
  }
}

bool check(std::vector<int> &vec) {
  static int cnt[kMaxN];
  std::fill_n(cnt + 1, n, 0);
  for (auto x : vec) ++cnt[dfn[x]];
  for (int i = 1; i <= n; ++i) cnt[i] += cnt[i - 1];
  for (auto x : vec) {
    assert(sz[x]);
    if (cnt[dfn[x] + sz[x] - 1] - cnt[dfn[x] - 1] != sz[x])
      return 0;
  }
  return 1;
}

bool check(std::vector<std::vector<int>> &vec) {
  for (auto &v : vec) {
    if (!check(v)) return 0;
  }
  return 1;
}

int solve(int N, int M, std::vector<int> F, std::vector<std::vector<int>> S) {
  ::n = N, ::m = M, cnt = 0;
  for (int i = 1; i <= n; ++i) G[i].clear();
  for (int i = 1; i <= n; ++i) {
    p[i] = F[i - 1] + 1;
    if (p[i]) G[p[i]].emplace_back(i);
  }
  dfs(1);
  for (auto &vec : S) {
    for (auto &x : vec) ++x;
  }
  std::fill_n(del + 1, n, 0);
  int ans = 0;
  std::vector<std::vector<int>> now;
  now.resize(m);
  for (int i = 0; i < n - 1; ++i) {
    for (int j = 0; j < m; ++j) {
      now[j].emplace_back(S[j][i]);
    }
    if (check(now)) ++ans;
    else assert(i + 1 != (int)S[0].size());
  }
  return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 11
Accepted

Test #1:

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

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: 5640kb

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: 1ms
memory: 3828kb

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: 1ms
memory: 5668kb

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: 1ms
memory: 5636kb

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: 1ms
memory: 5660kb

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: 5692kb

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: 5704kb

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: 3672kb

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: 2ms
memory: 3740kb

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: 2ms
memory: 5820kb

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: 0ms
memory: 5812kb

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: 2ms
memory: 5780kb

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: 2ms
memory: 3912kb

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: 0ms
memory: 5704kb

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: 2ms
memory: 5772kb

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: 2ms
memory: 5784kb

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: 2ms
memory: 5696kb

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: 2ms
memory: 5760kb

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: 2ms
memory: 5736kb

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: 2ms
memory: 6012kb

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: 6ms
memory: 5820kb

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: 6ms
memory: 3876kb

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: 6ms
memory: 5828kb

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: 3ms
memory: 5940kb

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: 0
Time Limit Exceeded

Dependency #3:

100%
Accepted

Test #41:

score: 0
Time Limit Exceeded

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:


result:


Subtask #8:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #7:

0%

Subtask #9:

score: 0
Skipped

Dependency #3:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #7:

0%

Subtask #10:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%