QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#420217 | #67. Two Transportations | Bronya | Compile Error | / | / | C++20 | 2.9kb | 2024-05-24 15:29:21 | 2024-05-24 15:29:24 |
Judging History
Azer
#include<bits/stdc++.h>
#include "Baijan.h"
using namespace std;
struct edge{
int obj;
int last;
int val;
}e[1000006];
int head[2005],g;
vector<int>dist;
void link(int u,int v,int w){
e[++g].obj=v;
e[g].last=head[u];
e[g].val=w;
head[u]=g;
}
priority_queue<pair<int,int> >q;
bool pd[2005],op;
int rev,last=0,rec,sav;
pair<int,int> check(){
while(!q.empty()&&pd[q.top().second])q.pop();
if(!q.empty())return q.top();
return {511,0};
}
void update(int u){
pd[u]=true;last=dist[u];
for(int i=head[u];i;i=e[i].last){
int v=e[i].obj,w=e[i].val;
if(dist[v]>dist[u]+w){
dist[v]=dist[u]+w;
q.push({-dist[v],v});
}
}
}
void Init(int x,int len){
for(int i=len-1;i>=0;i--)SendB(x&(1<<i));
}
void InitB(int N,int M,vector<int>U,vector<int>V,vector<int>W){
g=0;
for(int i=0;i<N;i++)head[i]=0,pd[i]=false;
dist.resize(N);
for(int i=1;i<N;i++)dist[i]=1e9;
for(int i=0;i<M;i++)link(U[i],V[i],W[i]),link(V[i],U[i],W[i]);
while(!q.empty())q.pop();
q.push({0,0});
rev=9;op=0;rec=0;update(0);
auto [len,u]=check();Init(len,9);
}
void RecieveB(bool x){
rec=(rec<<1)|(int)(x);rev--;
if(!rev){
auto [len,u]=check();
if(!op){
if(len<rec){
op=0,rev=9;rec=0;
update(u);
Init(u,11);Init(check().first,9);
}
else sav=rec,op=1,rev=11,rec=0;
}
else {
dist[rec]=sav+last;
update(rec);
op=0;rev=9;rec=0;
Init(check().first,9);
}
}
}
void Answer(){
return dist;
}
Baijan
#include<bits/stdc++.h>
#include "Baijan.h"
using namespace std;
struct edge{
int obj;
int last;
int val;
}e[1000006];
int head[2005],g;
vector<int>dist;
void link(int u,int v,int w){
e[++g].obj=v;
e[g].last=head[u];
e[g].val=w;
head[u]=g;
}
priority_queue<pair<int,int> >q;
bool pd[2005],op;
int rev,last=0,rec,sav;
pair<int,int> check(){
while(!q.empty()&&pd[q.top().second])q.pop();
if(!q.empty())return q.top();
return {511,0};
}
void update(int u){
pd[u]=true;last=dist[u];
for(int i=head[u];i;i=e[i].last){
int v=e[i].obj,w=e[i].val;
if(dist[v]>dist[u]+w){
dist[v]=dist[u]+w;
q.push({-dist[v],v});
}
}
}
void Init(int x,int len){
for(int i=len-1;i>=0;i--)SendB(x&(1<<i));
}
void InitB(int N,int M,vector<int>U,vector<int>V,vector<int>W){
g=0;
for(int i=0;i<N;i++)head[i]=0,pd[i]=false;
dist.resize(N);
for(int i=1;i<N;i++)dist[i]=1e9;
for(int i=0;i<M;i++)link(U[i],V[i],W[i]),link(V[i],U[i],W[i]);
while(!q.empty())q.pop();
q.push({0,0});
rev=9;op=0;rec=0;update(0);
auto [len,u]=check();Init(len,9);
}
void RecieveB(bool x){
rec=(rec<<1)|(int)(x);rev--;
if(!rev){
auto [len,u]=check();
if(!op){
if(len<rec){
op=0,rev=9;rec=0;
update(u);
Init(u,11);Init(check().first,9);
}
else sav=rec,op=1,rev=11,rec=0;
}
else {
dist[rec]=sav+last;
update(rec);
op=0;rev=9;rec=0;
Init(check().first,9);
}
}
}
Details
Azer.code: In function ‘void Answer()’: Azer.code:71:12: error: return-statement with a value, in function returning ‘void’ [-fpermissive] 71 | return dist; | ^~~~ grader_Azer.cpp: In function ‘int main(int, char**)’: grader_Azer.cpp:37:13: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 37 | char *t = "/dev/null"; | ^~~~~~~~~~~