QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#359722#408. Dungeon 2AdamGS97.097576 16ms4916kbC++232.3kb2024-03-20 20:16:562024-03-20 20:16:57

Judging History

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

  • [2024-03-20 20:16:57]
  • 评测
  • 测评结果:97.097576
  • 用时:16ms
  • 内存:4916kb
  • [2024-03-20 20:16:56]
  • 提交

answer

#include "dungeon2.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=207, INF=1e9+7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
vector<int>V[LIM], typ[LIM], P;
int odl[LIM][LIM], czy[LIM][LIM], jaki[LIM], pot[6], n=1;
int licz(int x, int k) {
  rep(i, k) x/=3;
  return x%3;
}
void DFS(int x, int o) {
  int a=NumberOfRoads();
  rep(i, a) {
    V[x].pb(0);
    typ[x].pb(0);
  }
  if(x!=o) {
    int p=LastRoad(); --p;
    V[x][p]=o;
    typ[x][p]=1;
  }
  rep(i, V[x].size()) if(typ[x][i]==0) {
    Move(i+1, 2);
    if(Color()!=1) {
      V[x][i]+=Color()-2;
      Move(LastRoad(), Color());
      continue;
    }
    V[x][i]=n++;
    typ[x][i]=2;
    DFS(n-1, x);
  }
  bool ok=false;
  rep(i, V[x].size()) if(typ[x][i]==0) {
    ok=true;
    P.pb(x);
    break;
  }
  rep(i, V[x].size()) if(typ[x][i]==1) Move(i+1, 2);
}
void DFS2(int x, int k) {
  rep(i, V[x].size()) if(typ[x][i]==2) {
    Move(i+1, licz(jaki[x], k)+1);
    DFS2(V[x][i], k);
  }
  rep(i, V[x].size()) if(typ[x][i]==0 || typ[x][i]==4) {
    Move(i+1, licz(jaki[x], k)+1);
    V[x][i]+=pot[k]*(Color()-1);
    if(typ[x][i]==0) {
      if(licz(jaki[x], k)>Color()-1) typ[x][i]=4; 
      else if(licz(jaki[x], k)<Color()-1) typ[x][i]=3;
    }
    Move(LastRoad(), Color());
  }
  rep(i, V[x].size()) if(typ[x][i]==1) Move(i+1, licz(jaki[x], k)+1);
}
void Inspect(int R) {
  pot[0]=1;
  rep(i, 5) pot[i+1]=3*pot[i];
  DFS(0, 0);
  rep(i, P.size()) swap(P[i], P[rng()%(i+1)]);
  rep(i, P.size()) jaki[P[i]]=i;
  for(int k=0; pot[k]<P.size(); ++k) DFS2(0, k);
  rep(i, n) rep(j, V[i].size()) {
    if(typ[i][j]==4) {
      czy[i][P[V[i][j]]]=czy[P[V[i][j]]][i]=1;
    } else if(typ[i][j]==1 || typ[i][j]==2) {
      czy[i][V[i][j]]=1;
    }
  }
  rep(i, n) {
    rep(j, n) odl[i][j]=INF;
    odl[i][i]=0;
    queue<int>q;
    q.push(i);
    while(!q.empty()) {
      int p=q.front(); q.pop();
      rep(j, n) if(czy[p][j] && odl[i][j]>odl[i][p]+1) { 
        odl[i][j]=odl[i][p]+1;
        q.push(j);
      }
    }
  }
  for(int d=1; d<=R; ++d) {
    int ans=0;
    rep(i, n) rep(j, i) if(odl[i][j]==d) ++ans;
    Answer(d, ans);
  }
}

详细

Subtask #1:

score: 17
Accepted

Test #1:

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

input:

10 100 50
7
5 7 10 4 6 2 3
2
1 5
3
1 10 7
2
10 1
3
1 9 2
2
1 7
5
9 6 8 3 1
1
7
2
5 7
3
1 4 3
15
24
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

output:

Accepted: #move = 116

result:

ok 

Test #2:

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

input:

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

output:

Accepted: #move = 204

result:

ok 

Test #3:

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

input:

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

output:

Accepted: #move = 314

result:

ok 

Test #4:

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

input:

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

output:

Accepted: #move = 334

result:

ok 

Test #5:

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

input:

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

output:

Accepted: #move = 528

result:

ok 

Test #6:

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

input:

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

output:

Accepted: #move = 1248

result:

ok 

Test #7:

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

input:

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

output:

Accepted: #move = 1050

result:

ok 

Test #8:

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

input:

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

output:

Accepted: #move = 842

result:

ok 

Test #9:

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

input:

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

output:

Accepted: #move = 778

result:

ok 

Test #10:

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

input:

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

output:

Accepted: #move = 196

result:

ok 

Test #11:

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

input:

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

output:

Accepted: #move = 1238

result:

ok 

Test #12:

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

input:

50 100 50
4
46 4 5 2
4
5 1 3 4
4
2 5 4 8
4
1 2 5 3
4
4 3 1 2
4
7 8 10 11
4
9 6 11 8
4
7 9 6 3
4
7 10 11 8
4
6 11 13 9
4
9 10 6 7
4
13 14 15 16
4
10 16 15 12
4
16 15 21 12
4
16 14 12 13
4
14 13 15 12
4
19 22 21 18
4
19 20 22 17
4
21 17 20 18
4
18 21 19 22
4
14 17 19 20
4
20 17 24 18
4
27 26 25 24
4
2...

output:

Accepted: #move = 1238

result:

ok 

Test #13:

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

input:

50 100 50
4
3 2 6 7
4
47 3 7 1
4
2 1 5 4
4
5 3 9 6
4
7 4 6 3
4
7 1 4 5
4
6 1 5 2
4
10 13 14 9
4
4 8 14 11
4
20 11 12 8
4
12 13 10 9
4
10 14 11 13
4
11 8 14 12
4
13 9 8 12
4
22 17 21 16
4
17 18 22 15
4
19 18 15 16
4
16 17 19 20
4
21 17 18 20
4
18 22 10 19
4
19 22 15 23
4
20 16 21 15
4
21 26 25 27
4
2...

output:

Accepted: #move = 1260

result:

ok 

Test #14:

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

input:

50 100 50
4
9 10 3 2
4
1 10 4 3
4
1 2 49 4
4
5 6 2 3
4
4 7 13 6
4
4 7 5 8
4
5 8 6 9
4
9 6 10 7
4
7 10 1 8
4
9 2 1 8
4
12 13 15 16
4
11 14 13 16
4
5 12 14 11
4
16 15 12 13
4
14 11 16 23
4
12 11 15 14
4
18 25 19 24
4
19 25 20 17
4
20 18 17 21
4
21 22 18 19
4
20 19 23 22
4
23 20 24 21
4
22 15 21 24
4
2...

output:

Accepted: #move = 1250

result:

ok 

Test #15:

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

input:

50 100 50
4
27 2 3 26
4
3 1 27 4
4
4 1 5 2
4
3 5 2 6
4
7 3 6 4
4
5 7 8 4
4
9 8 6 5
4
6 9 10 7
4
8 10 11 7
4
9 11 8 12
4
12 13 9 10
4
11 13 10 14
4
12 14 11 15
4
12 15 13 16
4
17 14 13 16
4
14 44 18 15
4
18 31 15 19
4
20 17 16 19
4
20 18 21 17
4
18 21 22 19
4
20 19 23 22
4
20 23 21 24
4
21 24 22 25
4...

output:

Accepted: #move = 1248

result:

ok 

Subtask #2:

score: 27
Accepted

Test #16:

score: 27
Accepted
time: 1ms
memory: 3872kb

input:

10 3 50
4
7 4 10 5
2
8 6
1
10
2
1 9
3
1 7 10
2
7 2
5
6 1 5 8 9
3
7 9 2
4
10 8 7 4
4
1 9 5 3
15
19
9
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

output:

Accepted: #move = 116

result:

ok 

Test #17:

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

input:

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

output:

Accepted: #move = 204

result:

ok 

Test #18:

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

input:

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

output:

Accepted: #move = 314

result:

ok 

Test #19:

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

input:

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

output:

Accepted: #move = 338

result:

ok 

Test #20:

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

input:

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

output:

Accepted: #move = 530

result:

ok 

Test #21:

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

input:

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

output:

Accepted: #move = 1266

result:

ok 

Test #22:

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

input:

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

output:

Accepted: #move = 1044

result:

ok 

Test #23:

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

input:

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

output:

Accepted: #move = 848

result:

ok 

Test #24:

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

input:

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

output:

Accepted: #move = 764

result:

ok 

Test #25:

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

input:

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

output:

Accepted: #move = 196

result:

ok 

Test #26:

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

input:

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

output:

Accepted: #move = 1248

result:

ok 

Test #27:

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

input:

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

output:

Accepted: #move = 1240

result:

ok 

Test #28:

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

input:

50 3 50
4
3 2 4 5
4
5 3 46 1
4
2 5 1 4
4
1 11 5 3
4
3 1 4 2
4
7 16 10 8
4
8 6 9 11
4
6 10 7 9
4
11 8 7 10
4
6 8 11 9
4
10 4 7 9
4
17 18 14 13
4
12 18 14 15
4
16 15 13 12
4
13 16 14 17
4
14 15 18 6
4
21 18 12 15
4
12 16 17 13
4
22 23 20 21
4
21 19 23 22
4
22 20 17 19
4
23 21 20 19
4
24 19 22 20
4
25 ...

output:

Accepted: #move = 1250

result:

ok 

Test #29:

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

input:

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

output:

Accepted: #move = 1248

result:

ok 

Test #30:

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

input:

50 3 50
4
29 2 30 3
4
30 4 1 3
4
5 4 1 2
4
5 3 6 2
4
3 4 7 6
4
5 4 8 7
4
9 6 5 8
4
6 9 10 7
4
11 10 8 7
4
9 11 12 8
4
12 10 9 13
4
13 14 11 10
4
14 15 12 11
4
15 12 13 16
4
16 14 13 17
4
18 15 17 14
4
16 15 18 19
4
17 19 20 16
4
21 20 18 17
4
18 22 19 21
4
45 23 20 19
4
20 34 24 23
4
24 21 22 25
4
2...

output:

Accepted: #move = 1246

result:

ok 

Subtask #3:

score: 53.0976
Acceptable Answer

Test #31:

score: 56
Accepted
time: 9ms
memory: 4704kb

input:

200 3 200
6
149 79 143 164 179 68
4
44 52 144 113
1
84
3
31 188 166
1
109
4
154 192 125 147
1
198
4
103 27 192 95
3
33 166 179
1
125
3
31 61 150
3
168 152 161
2
67 64
1
136
2
150 17
1
192
2
15 142
2
56 122
1
35
2
97 200
2
129 22
4
72 134 31 21
2
53 82
4
195 181 104 146
1
78
1
88
3
8 78 127
4
152 200...

output:

Accepted: #move = 1740

result:

points 1.0 L = 8.285714285714

Test #32:

score: 56
Accepted
time: 10ms
memory: 4476kb

input:

200 3 200
8
149 79 143 164 179 68 5 54
4
44 52 113 144
2
152 84
3
166 188 31
3
1 149 109
6
125 192 140 147 154 182
1
198
6
29 103 95 27 192 44
3
166 33 179
5
105 189 125 120 79
3
150 61 31
5
161 179 152 168 186
3
124 67 64
2
136 104
2
17 150
2
93 192
3
142 21 15
5
122 47 56 62 29
1
35
2
97 200
4
22 ...

output:

Accepted: #move = 4112

result:

points 1.0 L = 13.706666666667

Test #33:

score: 53.994
Acceptable Answer
time: 6ms
memory: 4480kb

input:

200 3 200
11
149 79 143 164 179 190 5 54 123 22 68
11
43 6 165 52 44 45 144 197 113 142 96
9
74 182 152 49 84 128 26 106 22
12
188 66 50 127 9 104 31 166 128 123 191 43
9
179 128 60 13 149 47 109 1 178
13
81 23 84 31 67 192 154 182 125 140 2 147 51
7
198 155 32 123 27 169 171
12
27 106 157 192 174 9...

output:

Accepted: #move = 16006

result:

points 0.96417857140 L = 16.006000000000

Test #34:

score: 53.0976
Acceptable Answer
time: 16ms
memory: 4840kb

input:

200 3 200
198
116 13 87 107 11 78 74 63 61 37 25 98 130 91 179 53 16 122 140 114 182 23 191 75 67 49 5 190 161 134 156 129 160 35 118 149 76 115 73 97 166 174 4 153 9 27 192 68 72 90 56 126 196 10 165 169 12 86 112 154 69 85 180 104 83 105 171 170 197 28 21 40 128 186 93 181 187 71 119 145 111 100 1...

output:

Accepted: #move = 334668

result:

points 0.94817099570 L = 16.902424242424

Test #35:

score: 56
Accepted
time: 0ms
memory: 4044kb

input:

64 3 200
6
33 28 46 15 58 60
6
4 9 7 29 6 23
6
26 55 24 60 47 15
6
2 60 10 55 62 28
6
46 59 33 57 42 37
6
62 13 27 40 2 50
6
10 37 2 19 27 59
6
11 32 47 51 24 30
6
60 2 37 26 13 33
6
7 41 4 44 49 48
6
8 34 14 16 52 64
6
57 56 15 46 30 24
6
53 6 16 14 9 18
6
47 40 11 13 26 25
6
35 17 12 1 61 3
6
51 2...

output:

Accepted: #move = 2556

result:

points 1.0 L = 13.312500000000

Test #36:

score: 54.3973
Acceptable Answer
time: 0ms
memory: 4228kb

input:

128 3 200
7
76 20 77 118 67 79 19
7
59 10 117 87 57 48 126
7
4 124 120 18 9 108 102
7
3 50 85 64 112 33 34
7
90 67 111 16 20 91 28
7
128 9 100 74 124 29 63
7
20 76 46 56 90 27 45
7
21 96 56 46 58 123 70
7
112 6 109 54 3 106 81
7
51 2 60 14 39 86 122
7
49 37 106 88 101 109 119
7
89 61 105 15 127 26 7...

output:

Accepted: #move = 6990

result:

points 0.97138073980 L = 15.602678571429

Test #37:

score: 55.525
Acceptable Answer
time: 10ms
memory: 4456kb

input:

200 3 200
4
124 13 181 135
4
95 61 84 64
4
54 165 63 78
4
194 11 43 196
4
185 157 69 128
4
24 30 101 74
4
119 47 33 123
4
104 87 142 9
4
104 87 8 142
4
165 153 169 152
4
43 196 4 104
4
25 29 34 177
4
181 135 1 113
4
96 116 176 100
4
179 151 108 80
4
37 90 162 40
4
103 77 73 109
4
156 182 129 107
4
6...

output:

Accepted: #move = 5790

result:

points 0.99151785710 L = 14.475000000000

Test #38:

score: 54.4257
Acceptable Answer
time: 9ms
memory: 4720kb

input:

200 3 200
7
129 74 118 72 42 139 98
7
109 150 8 167 89 54 27
7
150 188 92 142 120 197 169
7
121 146 152 63 53 159 65
7
180 145 34 35 128 177 119
7
17 11 122 37 135 14 170
7
174 187 183 21 160 151 192
7
109 150 167 89 2 54 27
7
176 29 15 78 140 66 198
7
165 179 141 76 56 103 110
7
122 37 135 14 170 6...

output:

Accepted: #move = 10902

result:

points 0.97188775510 L = 15.574285714286

Test #39:

score: 54.1889
Acceptable Answer
time: 9ms
memory: 4556kb

input:

200 3 200
9
98 64 145 124 111 33 105 66 199
9
121 187 39 175 25 167 127 42 137
9
116 85 17 9 154 99 24 139 104
9
41 72 10 119 89 160 13 129 47
9
181 81 168 161 185 157 59 82 35
9
192 117 182 106 77 188 88 144 156
9
94 122 130 165 177 74 101 172 184
9
176 52 189 170 73 95 118 195 197
9
116 85 17 154 ...

output:

Accepted: #move = 14230

result:

points 0.96765873020 L = 15.811111111111

Test #40:

score: 55.46
Acceptable Answer
time: 9ms
memory: 4724kb

input:

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

output:

Accepted: #move = 5816

result:

points 0.99035714290 L = 14.540000000000

Test #41:

score: 54.6033
Acceptable Answer
time: 9ms
memory: 4552kb

input:

200 3 200
6
2 9 8 4 3 7
6
8 9 5 1 3 4
6
9 6 5 2 4 1
6
6 2 3 5 7 1
6
194 2 3 7 8 4
6
7 9 11 8 4 3
6
5 1 9 8 6 4
6
2 5 6 1 7 9
6
2 1 7 6 3 8
6
14 11 15 16 13 12
6
16 15 6 12 13 10
6
11 10 16 13 15 14
6
11 10 16 15 14 12
6
15 12 21 10 13 16
6
10 12 11 13 16 14
6
13 11 14 12 10 15
6
22 18 21 20 19 23
6
...

output:

Accepted: #move = 9238

result:

points 0.97505952380 L = 15.396666666667

Test #42:

score: 54.3025
Acceptable Answer
time: 10ms
memory: 4544kb

input:

200 3 200
8
10 8 3 9 2 11 4 5
8
4 1 5 3 6 11 9 10
8
4 1 10 11 7 6 2 5
8
1 3 6 5 7 11 8 2
8
8 7 2 9 3 1 4 6
8
4 8 7 9 200 5 3 2
8
9 10 8 4 11 6 5 3
8
10 5 11 1 6 7 9 4
8
5 7 8 6 1 10 11 2
8
1 7 9 11 8 2 14 3
8
9 10 8 1 2 3 7 4
8
16 23 13 24 14 15 22 21
8
24 23 16 12 14 17 15 22
8
13 10 24 18 15 16 12...

output:

Accepted: #move = 12558

result:

points 0.96968750 L = 15.697500000000

Test #43:

score: 53.3225
Acceptable Answer
time: 10ms
memory: 4588kb

input:

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

output:

Accepted: #move = 66710

result:

points 0.95218750 L = 16.677500000000

Test #44:

score: 56
Accepted
time: 9ms
memory: 4708kb

input:

200 3 200
1
120
1
120
2
154 99
2
156 98
2
72 192
1
190
1
71
2
65 113
4
149 131 163 196
3
172 76 78
2
59 186
1
32
4
183 147 129 145
3
160 188 195
2
185 159
2
139 78
2
65 71
3
177 64 60
1
97
3
155 171 75
1
37
1
186
1
137
2
77 132
1
131
2
45 147
1
141
1
187
2
91 144
4
165 154 179 138
2
143 159
2
12 130...

output:

Accepted: #move = 1224

result:

points 1.0 L = 6.059405940594

Test #45:

score: 55.51
Acceptable Answer
time: 9ms
memory: 4540kb

input:

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

output:

Accepted: #move = 5796

result:

points 0.991250 L = 14.490000000000

Test #46:

score: 53.1802
Acceptable Answer
time: 3ms
memory: 4304kb

input:

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

output:

Accepted: #move = 78330

result:

points 0.94964569470 L = 16.819841099420

Test #47:

score: 53.1006
Acceptable Answer
time: 14ms
memory: 4916kb

input:

200 3 50
196
192 18 91 149 145 72 185 32 99 133 130 131 16 40 183 137 155 176 47 126 21 106 164 49 29 85 200 127 26 51 65 78 25 175 8 97 141 96 161 156 120 27 46 3 36 55 177 110 70 198 59 119 135 62 34 143 20 94 112 160 100 63 134 157 195 44 11 196 139 42 181 115 140 114 132 169 168 136 162 122 151 ...

output:

Accepted: #move = 326276

result:

points 0.9482256620 L = 16.899362925364

Test #48:

score: 53.1025
Acceptable Answer
time: 14ms
memory: 4820kb

input:

200 3 50
189
146 164 90 194 199 37 56 137 71 125 105 127 115 10 111 86 45 200 159 30 57 101 160 112 167 2 117 147 151 138 157 165 173 192 16 23 177 163 8 148 63 67 185 179 118 129 162 87 183 136 113 161 131 100 156 5 169 88 196 139 168 4 124 92 20 7 80 24 69 195 29 132 174 46 134 181 83 104 198 82 1...

output:

Accepted: #move = 303446

result:

points 0.94825823750 L = 16.897538701414

Test #49:

score: 53.1023
Acceptable Answer
time: 14ms
memory: 4840kb

input:

200 3 50
189
36 131 72 74 175 88 147 57 110 97 32 186 90 120 152 69 102 67 159 83 81 138 187 107 24 191 137 82 130 20 100 49 27 18 135 141 77 91 63 54 133 103 35 136 157 122 171 21 55 59 50 109 10 199 6 170 167 68 12 158 178 149 14 177 73 65 198 132 16 58 11 172 92 5 60 7 28 31 183 129 70 75 17 118 ...

output:

Accepted: #move = 303094

result:

points 0.94825540180 L = 16.897697496794