QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#359742#408. Dungeon 2TlenekWodoru0 3ms4496kbC++142.4kb2024-03-20 20:33:002024-03-20 20:33:00

Judging History

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

  • [2024-03-20 20:33:00]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:4496kb
  • [2024-03-20 20:33:00]
  • 提交

answer

#include<bits/stdc++.h>
#include "dungeon2.h"
using namespace std;
int D[209][209];
int d[209][209];
int wynik[209];
int siz[209];
int h=1;
void DFS(int last)
{
    int v=h,l=LastRoad();
    siz[v]=NumberOfRoads();
    D[v][l]=last;
    for(int i=1;i<=siz[v];i++)
    {
        Move(i,2);
        if(Color()==2)
        {
            Move(LastRoad(),2);
        }
        else
        {
            h++;
            D[v][i]=h;
            DFS(v);
        }
    }
    if(v!=1){Move(l,2);}
}
int poww[10];
int Bit(int x, int u)
{
    for(int i=1;i<=u;i++)
    {
        x/=3;
    }
    return x%3;
}
void DFSWyp(int v, int bit, int last)
{
    int kamien=Bit(v,bit)+1,l=LastRoad();
    for(int i=1;i<=siz[v];i++)
    {
        if(D[v][i]<=0||D[v][i]==last){continue;}
        Move(i,kamien);
        DFSWyp(D[v][i],bit,v);
    }
    if(last!=-1)
    {
        Move(l,kamien);
    }
}
void DFSUwu(int v, int bit, int last)
{
    int kamien=Bit(v,bit)+1,l=LastRoad();
    for(int i=1;i<=siz[v];i++)
    {
        if(D[v][i]==last){continue;}
        if(D[v][i]<=0)
        {
            Move(i,Color());
            D[v][i]-=(Color()-1)*poww[bit];
            Move(LastRoad(),Color());
        }
        else
        {
            Move(i,Color());
            DFSUwu(D[v][i],bit,v);
        }
    }
    if(last!=-1)
    {
        Move(l,Color());
    }
}
void Inspect(int R)
{
    poww[0]=1;for(int i=1;i<10;i++){poww[i]=poww[i-1]*3;}
    DFS(-1);
    int m=0;
    for(int i=1;i<10;i++)
    {
        if(poww[i]>h){m=i;break;}
    }
    for(int i=0;i<m;i++)
    {
        DFSWyp(1,i,-1);
        DFSUwu(1,i,-1);
    }
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=h;j++)
        {
            d[i][j]=1001;
        }
        d[i][i]=0;
    }
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=siz[i];j++)
        {
            D[i][j]=abs(D[i][j]);
            d[i][D[i][j]]=1;
        }
    }
    for(int k=1;k<=h;k++)
    {
        for(int i=1;i<=h;i++)
        {
            for(int j=1;j<=h;j++)
            {
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
    for(int i=1;i<=h;i++)
    {
        for(int j=i+1;j<=h;j++)
        {
            wynik[d[i][j]]++;
        }
    }
    for(int i=1;i<=R;i++)
    {
        Answer(i,wynik[i]);
    }
}
//g++ -o dungeon2 dungeon2.cpp grader.cpp;

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

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:

Wrong Answer [4]

result:


Subtask #3:

score: 0
Runtime Error

Test #31:

score: 46
Acceptable Answer
time: 3ms
memory: 4496kb

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

result:

points 0.82142857140 L = 24.000000000000

Test #32:

score: 0
Runtime Error

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:

Wrong Answer [4]

result: