QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#359673#408. Dungeon 2AdamGS0 0ms4208kbC++231.9kb2024-03-20 19:53:132024-03-20 19:53:14

Judging History

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

  • [2024-03-20 19:53:14]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:4208kb
  • [2024-03-20 19:53:13]
  • 提交

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;
vector<int>V[LIM], typ[LIM], P;
int odl[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;
    jaki[x]=P.size();
    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) {
    Move(i+1, licz(jaki[x], k)+1);
    V[x][i]+=pot[k]*(Color()-1);
    Move(LastRoad(), Color());
  }
  rep(i, V[x].size()) if(typ[x][i]==1) Move(i+1, licz(x, k)+1);
}
void Inspect(int R) {
  pot[0]=1;
  rep(i, 5) pot[i+1]=3*pot[i];
  DFS(0, 0);
  for(int k=0; pot[k]<P.size(); ++k) DFS2(0, k);
  rep(i, n) rep(j, V[i].size()) if(typ[i][j]==0) V[i][j]=P[V[i][j]];
  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();
      for(auto j : V[p]) if(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: 0
Runtime Error

Test #1:

score: 0
Runtime Error

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:

Wrong Answer [4]

result:


Subtask #2:

score: 0
Runtime Error

Test #16:

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

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 = 126

result:

ok 

Test #17:

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

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: -27
Runtime Error

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:

Wrong Answer [4]

result:


Subtask #3:

score: 0
Runtime Error

Test #31:

score: 0
Runtime Error

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:

Wrong Answer [4]

result: