QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#798350 | #408. Dungeon 2 | yinhee | Compile Error | / | / | C++14 | 2.1kb | 2024-12-04 12:38:33 | 2024-12-04 12:38:36 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
namespace my_std{
#define mems(x,y) memset(x,y,sizeof x)
#define Mp make_pair
#define eb emplace_back
#define gc getchar
#define pc putchar
#define fi first
#define se second
#define il inline
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define drep(i,a,b) for(int i=(a);i>=(b);i--)
#define go(i,u) for(int i=head[u];i;i=e[i].nxt)
typedef long long ll;
typedef pair<int,int> pii;
template<typename T>
il void read(T &x){
int f=1;x=0;char c=gc();
while(c<'0'||c>'9'){
if(c=='-'){
f=-1;
}
c=gc();
}
while(c>='0'&&c<='9'){
x=x*10+c-48,c=gc();
}
x*=f;
}
template<typename T,typename ...Args>
void read(T &x,Args &...args){
read(x),read(args...);
}
template<typename T>
il void write(T x){
char buf[43];int len=0;
if(x<0){
pc('-'),x=-x;
}
do{
buf[++len]=x%10,x/=10;
}while(x);
while(len){
pc(buf[len--]+'0');
}
}
}
using namespace my_std;
const int N=207,M=-1,inf=0x3f3f3f3f,mod=0;
const ll INF=1ll*inf*inf;
int n,m,pw,cur,deg[N],f[N][N],g[N][N],dis[N][N],ans[N];
bool pd[N][N];
void dfs1(int u){
n++;
deg[u]=NumberOfRoads();
rep(i,1,deg[u]){
Move(i,2);
if(Color()==2){
Move(LastRoad(),2);
continue;
}
if(Color()==3){
Move(LastRoad(),3);
pd[u][i]=1;
continue;
}
int v=f[u][i]=g[u][i]=++cur;
int frm=LastRoad();
dfs1(v);
Move(frm,3);
}
}
void dfs2(int u){
rep(i,1,deg[u]){
if(f[u][i]){
Move(i,u/pw%3+1);
int v=f[u][i],frm=LastRoad();
dfs2(v);
Move(frm,v/pw%3+1);
}else if(pd[u][i]){
Move(i,u/pw%3+1);
g[u][i]+=(Color()-1)*pw;
Move(LastRoad(),Color());
}
}
}
void Inspect(int R){
pw=cur=1,dfs1(1);
rep(i,0,4){
dfs2(1);
pw*=3;
}
mems(dis,0x3f);
rep(i,1,n){
rep(j,1,deg[i]){
int u=g[i][j];
if(u){
dis[i][u]=dis[u][i]=1;
}
}
}
rep(k,1,n){
rep(i,1,n){
rep(j,1,n){
dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
}
}
}
rep(i,1,n){
rep(j,i+1,n){
ans[dis[i][j]]++;
}
}
rep(i,1,R){
Answer(i,ans[i]);
}
}
詳細信息
implementer.cpp: In function ‘int main()’: implementer.cpp:94:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 94 | scanf("%d", &(n_roads[i])); | ~~~~~^~~~~~~~~~~~~~~~~~~~~ implementer.cpp:98:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 98 | scanf("%d", &(road[i][j])); | ~~~~~^~~~~~~~~~~~~~~~~~~~~ implementer.cpp:105:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 105 | scanf("%d", &(expected_answer[i])); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ answer.code: In function ‘void dfs1(int)’: answer.code:56:16: error: ‘NumberOfRoads’ was not declared in this scope 56 | deg[u]=NumberOfRoads(); | ^~~~~~~~~~~~~ answer.code:58:17: error: ‘Move’ was not declared in this scope; did you mean ‘remove’? 58 | Move(i,2); | ^~~~ | remove answer.code:59:20: error: ‘Color’ was not declared in this scope 59 | if(Color()==2){ | ^~~~~ answer.code:60:30: error: ‘LastRoad’ was not declared in this scope 60 | Move(LastRoad(),2); | ^~~~~~~~ answer.code:63:20: error: ‘Color’ was not declared in this scope 63 | if(Color()==3){ | ^~~~~ answer.code:64:30: error: ‘LastRoad’ was not declared in this scope 64 | Move(LastRoad(),3); | ^~~~~~~~ answer.code:69:25: error: ‘LastRoad’ was not declared in this scope 69 | int frm=LastRoad(); | ^~~~~~~~ answer.code: In function ‘void dfs2(int)’: answer.code:77:25: error: ‘Move’ was not declared in this scope; did you mean ‘remove’? 77 | Move(i,u/pw%3+1); | ^~~~ | remove answer.code:78:43: error: ‘LastRoad’ was not declared in this scope 78 | int v=f[u][i],frm=LastRoad(); | ^~~~~~~~ answer.code:82:25: error: ‘Move’ was not declared in this scope; did you mean ‘remove’? 82 | Move(i,u/pw%3+1); | ^~~~ | remove answer.code:83:35: error: ‘Color’ was not declared in this scope 83 | g[u][i]+=(Color()-1)*pw; | ^~~~~ answer.code:84:30: error: ‘LastRoad’ was not declared in this scope 84 | Move(LastRoad(),Color()); | ^~~~~~~~ answer.code: In function ‘void Inspect(int)’: answer.code:116:17: error: ‘Answer’ was not declared in this scope 116 | Answer(i,ans[i]); | ^~~~~~