QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#481342 | #408. Dungeon 2 | Rafi22 | 0 | 0ms | 4176kb | C++20 | 2.3kb | 2024-07-17 03:34:09 | 2024-07-17 03:34:10 |
answer
#include "dungeon2.h"
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
auto&operator<<(auto&o,pair<auto,auto>p){return o<<"("<<p.first<<", "<<p.second<<")";}
auto operator<<(auto&o,auto x)->decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<<e;return o<<"}";}
#define debug(X...)cerr<<"["#X"]: ",[](auto...$){((cerr<<$<<"; "),...)<<endl;}(X)
#else
#define debug(...){}
#endif
#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define FOR(i,l,r) for(int i=(l);i<=(r);i++)
#define ROF(i,r,l) for(int i=(r);i>=(l);i--)
int inf=1000000007;
ll infl=1000000000000000007;
ll mod=1000000007;
ll mod1=998244353;
const int N=207;
vector<int>G[N];
vector<int>G1[N];
int ile[N][N];
bool is[N][N];
int M[N];
int O[N];
vector<int>val={2,3,1};
int it;
void dfs(int v,int j,int d)
{
O[v]=LastRoad();
if(v!=1) is[v][LastRoad()]=1;
int m=NumberOfRoads();
M[v]=m;
debug(v);
FOR(i,1,m)
{
if(i==LastRoad()&&v!=1) continue;
Move(i,val[(d&(1<<j))>0]);
if(Color()==val[0]) Move(LastRoad(),Color());
else if(Color()==val[1])
{
ile[v][i]+=(1<<j);
debug(v,i,j);
Move(LastRoad(),Color());
}
else
{
is[v][i]=1;
it++;
if(j==0) G[v].pb(it);
debug(i);
dfs(it,j,d+1);
}
}
if(v!=1) Move(O[v],val[0]);
}
vector<int>ord;
int xd[N];
vector<pair<int,int>>E;
void dfs1(int v,int d)
{
ord.pb(v);
for(auto u:G[v])
{
dfs1(u,d+1);
E.pb({u,v});
}
FOR(i,1,M[v])
{
if(!is[v][i])
{
if(ile[v][i]==0&&xd[v]>0) xd[v]--;
else
{
E.pb({v,ord[ile[v][i]]});
xd[ord[ile[v][i]]]++;
}
}
}
}
int ans[N];
int D[N];
void Inspect(int R)
{
int n;
FOR(j,0,7)
{
it=1;
dfs(1,j,0);
n=it;
swap(val[0],val[2]);
debug("XD");
}
dfs1(1,0);
debug(E);
for(auto [u,v]:E)
{
G[u].pb(v);
G[v].pb(u);
}
FOR(i,1,n)
{
deque<int>Q;
Q.pb(i);
FOR(j,1,n) D[j]=inf;
D[i]=0;
while(sz(Q)>0)
{
int v=Q[0];
Q.pop_front();
ans[D[v]]++;
for(auto u:G[v])
{
if(D[u]==inf)
{
D[u]=D[v]+1;
Q.pb(u);
}
}
}
}
FOR(i,1,R)
{
debug(i,ans[i]);
Answer(i,ans[i]/2);
}
}
詳細信息
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 17
Accepted
time: 0ms
memory: 4176kb
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 = 400
result:
ok
Test #2:
score: -17
Runtime Error
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:
Wrong Answer [4]
result:
Subtask #2:
score: 0
Runtime Error
Test #16:
score: 27
Accepted
time: 0ms
memory: 4160kb
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 = 448
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]