QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#522611 | #67. Two Transportations | maojun | Compile Error | / | / | C++23 | 2.5kb | 2024-08-17 06:50:11 | 2024-08-17 06:50:12 |
Judging History
Azer
#include<bits/stdc++.h>
#include"transportations.h"
using namespace std;
typedef vector<int> vct;
const int N=2005,E=1e6+5;
#define go for(int i=hd[u];i;i=nxt[i])
namespace A{
int n,m;
int tot=0,hd[N],to[E],nxt[E],ew[E];
inline void Add(int u,int v,int w){to[++tot]=v;nxt[tot]=hd[u];hd[u]=tot;ew[tot]=w;}
int op,bit,tp,lst=0,dis[N];bool vs[N];
int Aw,Bw,Mw;
inline void gtop(){
int mn=dis[n];tp=-1;
for(int i=0;i<n;i++)if(!vs[i]&&dis[i]<mn){mn=dis[i];tp=i;}
if(!~tp)return;Aw=min(mn-lst,511);
for(int i=8;~i;i--)SendA(Aw>>i&1);
}
inline void upd(int u){
if(u>=n)return;vs[u]=1;lst=dis[u];
go if(int v=to[i];!vs[v])dis[v]=min(dis[v],dis[u]+ew[i]);
gtop();
}
void ReceiveA(bool x){
Bw=Bw<<1|x;if(--bit)return;
if(op){
if(Aw<=Bw){Bw=0;op=1;bit=9;for(int i=10;~i;i--)SendA(tp>>i&1);upd(tp);}
else{op=0;bit=11;Mw=lst+Bw;Bw=0;}
}else{int u=Bw;Bw=0;op=1;bit=9;dis[u]=Mw;upd(u);}
}
void InitA(int N,int A,vct U,vct V,vct C){
n=N;m=A;
for(int i=0;i<m;i++){Add(U[i],V[i],C[i]);Add(V[i],U[i],C[i]);}
memset(dis,0x3f,sizeof dis);dis[0]=0;
op=1;bit=9;gtop();
}
}
void InitA(int N,int A,vct U,vct V,vct C){A::InitA(N,A,U,V,C);}
void ReceiveA(bool x){A::ReceiveA(x);}
vct Answer(){vct as;for(int i=0;i<A::n;i++)as.emplace_back(A::dis[i]);return as;}
Baijan
#include<bits/stdc++.h>
#include"transportations.h"
using namespace std;
typedef vector<int> vct;
const int N=2005,E=1e6+5;
#define go for(int i=hd[u];i;i=nxt[i])
namespace B{
int n,m;
int tot=0,hd[N],to[E],nxt[E],ew[E];
inline void Add(int u,int v,int w){to[++tot]=v;nxt[tot]=hd[u];hd[u]=tot;ew[tot]=w;}
int op,bit,tp,lst=0,dis[N];bool vs[N];
int Aw,Bw,Mw;
inline void gtop(){
int mn=dis[n];tp=-1;
for(int i=0;i<n;i++)if(!vs[i]&&dis[i]<mn){mn=dis[i];tp=i;}
if(!~tp)return;Bw=min(mn-lst,511);
for(int i=8;~i;i--)SendB(Bw>>i&1);
}
inline void upd(int u){
if(u>=n)return;vs[u]=1;lst=dis[u];
go if(int v=to[i];!vs[v])dis[v]=min(dis[v],dis[u]+ew[i]);
gtop();
}
void ReceiveB(bool x){
Aw=Aw<<1|x;if(--bit)return;
if(op){
if(Aw<=Bw){op=0;bit=11;Mw=lst+Aw;Aw=0;}
else{Aw=0;op=1;bit=9;for(int i=10;~i;i--)SendB(tp>>i&1);upd(tp);}
}else{int u=Aw;Aw=0;op=1;bit=9;dis[u]=Mw;upd(u);}
}
void InitB(int N,int B,vct S,vct T,vct D){
n=N;m=B;
for(int i=0;i<m;i++){Add(S[i],T[i],D[i]);Add(T[i],S[i],D[i]);}
memset(dis,0x3f,sizeof dis);dis[0]=0;
op=1;bit=9;gtop();
}
}
void InitB(int N,int B,vct S,vct T,vct D){B::InitB(N,B,S,T,D);}
void ReceiveB(bool x){B::ReceiveB(x);}
详细
Azer.code:2:9: fatal error: transportations.h: No such file or directory 2 | #include"transportations.h" | ^~~~~~~~~~~~~~~~~~~ compilation terminated. In file included from grader_Azer.cpp:2: testlib.h: In member function ‘std::vector<T> random_t::distinct(int, T, T)’: testlib.h:997:9: error: ‘uint64_t’ was not declared in this scope; did you mean ‘u_int64_t’? 997 | uint64_t n = to - from + 1; | ^~~~~~~~ | u_int64_t testlib.h:998:30: error: ‘n’ was not declared in this scope 998 | if (uint64_t(size) > n) | ^ testlib.h:1007:32: error: ‘n’ was not declared in this scope 1007 | expected += double(n) / double(n - i + 1); | ^ testlib.h:1009:31: error: ‘n’ was not declared in this scope 1009 | if (expected < double(n)) { | ^ grader_Azer.cpp: In function ‘int main(int, char**)’: grader_Azer.cpp:37:13: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] 37 | char *t = "/dev/null"; | ^~~~~~~~~~~