QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#812605 | #67. Two Transportations | guleng2007# | Compile Error | / | / | C++23 | 3.4kb | 2024-12-13 17:02:39 | 2024-12-13 17:02:40 |
Judging History
Azer
#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;
const int N=2005;
namespace
{
vector <int> g[N], w[N];
int d[N], n, bestval, val, cur;
bool vis[N], trans;
int getbest()
{
int best=0;
for(int j=1;j<=n;j++)
if(!vis[j] && (!best || d[j]<d[best]))
best=j;
return best;
}
int lastval()
{
int Max=0;
for(int i=1;i<=n;i++)
if(vis[i])
Max=max(Max,d[i]);
return Max;
}
void report_val(int val)
{
val=min(val-lastval(),511);
for(int i=8;i>=0;i--)
SendA((val>>i)&1), cur++;
}
void report_id(int val)
{
for(int i=10;i>=0;i--)
SendA((val>>i)&1), cur++;
}
}
void ReceiveA(bool x)
{
val=val*2+x, cur++;
if(!trans && cur==9)
{
int best=getbest();
report_val(d[best]);
if(d[best]<=val)
{
report_id(best);
vis[best]=true;
trans=false, cur=0, val=0;
}
else
trans=true, bestval=val, val=0;
return;
}
if(trans && cur==18)
{
int best=getbest();
if(d[best]<=val)
{
report_id(best);
vis[best]=true;
trans=false, cur=0, val=0;
}
else
trans=true, bestval=val, val=0;
return;
}
if(trans && cur==29)
{
d[val]=bestval+lastval();
vis[val]=true;
trans=false, cur=0, val=0;
return;
}
}
void InitA(int N, int A, vector<int> U, vector<int> V, vector<int> C)
{
n=N;
int m=V.size();
for(int i=0;i<m;i++)
{
g[U[i]+1].push_back(V[i]+1);
g[V[i]+1].push_back(U[i]+1);
w[U[i]+1].push_back(C[i]);
w[V[i]+1].push_back(C[i]);
}
memset(d,0x3f,sizeof(d));
d[1]=0, vis[1]=true;
for(int i=0;i<g[1].size();i++)
d[g[1][i]]=min(d[g[1][i]],d[1]+w[1][i]);
if(n==1)
return;
trans=true, report_val(d[getbest()]);
}
vector <int> Answer()
{
vector <int> ans;
for(int i=1;i<=n;i++)
ans.push_back(d[i]);
return ans;
}
Baijan
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
const int N=2005;
namespace
{
vector <int> g[N], w[N];
int d[N], n, bestval, val, cur;
bool vis[N], trans;
int getbest()
{
int best=0;
for(int j=1;j<=n;j++)
if(!vis[j] && (!best || d[j]<d[best]))
best=j;
return best;
}
int lastval()
{
int Max=0;
for(int i=1;i<=n;i++)
if(vis[i])
Max=max(Max,d[i]);
return Max;
}
void report_val(int val)
{
val=min(val-lastval(),511);
for(int i=8;i>=0;i--)
SendB((val>>i)&1), cur++;
}
void report_id(int val)
{
for(int i=10;i>=0;i--)
SendB((val>>i)&1), cur++;
}
}
void ReceiveB(bool x)
{
val=val*2+x, cur++;
if(!trans && cur==9)
{
int best=getbest();
report_val(d[best]);
if(d[best]<val)
{
report_id(best);
vis[best]=true;
trans=false, cur=0, val=0;
}
else
trans=true, bestval=val, val=0;
return;
}
if(trans && cur==18)
{
int best=getbest();
if(d[best]<val)
{
report_id(best);
vis[best]=true;
trans=false, cur=0, val=0;
}
else
trans=true, bestval=val, val=0;
return;
}
if(trans && cur==29)
{
d[val]=bestval+lastval();
vis[val]=true;
trans=false, cur=0, val=0;
return;
}
}
void InitB(int N, int B, vector<int> U, vector<int> V, vector<int> C)
{
n=N;
int m=V.size();
for(int i=0;i<m;i++)
{
g[U[i]+1].push_back(V[i]+1);
g[V[i]+1].push_back(U[i]+1);
w[U[i]+1].push_back(C[i]);
w[V[i]+1].push_back(C[i]);
}
memset(d,0x3f,sizeof(d));
d[1]=0, vis[1]=true;
for(int i=0;i<g[1].size();i++)
d[g[1][i]]=min(d[g[1][i]],d[1]+w[1][i]);
if(n==1)
return;
}
Details
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"; | ^~~~~~~~~~~