QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#359650#408. Dungeon 2AdamGS0 1ms3856kbC++231.7kb2024-03-20 19:44:062024-03-20 19:46:13

Judging History

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

  • [2024-03-20 19:46:13]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3856kb
  • [2024-03-20 19:44:06]
  • 提交

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];
int odl[LIM][LIM], pot[6], n=1;
int licz(int x, int k) {
  x/=2;
  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, x%2+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);
  }
  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(x, k)+1);
    DFS2(V[x][i], k);
  }
  rep(i, V[x].size()) if(typ[x][i]==0) {
    Move(i+1, licz(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]=2;
  rep(i, 5) pot[i+1]=3*pot[i];
  DFS(0, 0);
  for(int k=0; pot[k]<n; ++k) DFS2(0, k);
  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);
  }
}

Details

Tip: Click on the bar to expand more detailed information

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

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

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:

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: