이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int cura,nodea,statea,adda;
vector<int> dista,da;
vector<pair<int,int> > va[2005];
set<pair<int,int> > sa;
void upda(int node)
{
sa.erase({dista[node],node});
dista[node]=cura;
for (auto p:va[node])
{
if (cura+p.second<dista[p.first])
{
sa.erase({dista[p.first],p.first});
dista[p.first]=cura+p.second;
sa.insert({dista[p.first],p.first});
}
}
if (sa.empty())
return;
nodea=sa.begin()->second;
for (int i=0;i<9;i++)
SendA(min(dista[nodea]-cura,511)&(1<<i));
}
void InitA(int n,int a,vector<int> u,vector<int> v,vector<int> c)
{
for (int i=0;i<a;i++)
{
va[u[i]].push_back({v[i],c[i]});
va[v[i]].push_back({u[i],c[i]});
}
for (int i=0;i<n;i++)
{
dista.push_back(1e9);
sa.insert({dista[i],i});
}
upda(0);
}
void ReceiveA(bool x)
{
da.push_back(x);
if (!statea && da.size()==9)
{
adda=0;
for (int i=0;i<9;i++)
adda|=(da[i]<<i);
da.clear();
if (dista[nodea]<cura+adda)
{
cura=dista[nodea];
for (int i=0;i<11;i++)
SendA(nodea&(1<<i));
upda(nodea);
}
else
{
cura+=adda;
statea=1;
}
}
if (statea && da.size()==11)
{
int node=0;
for (int i=0;i<11;i++)
node|=(da[i]<<i);
da.clear();
statea=0;
upda(node);
}
}
vector<int> Answer()
{
return dista;
}
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
int curb,nodeb,stateb,addb;
vector<int> distb,db;
vector<pair<int,int> > vb[2005];
set<pair<int,int> > sb;
void updb(int node)
{
sb.erase({distb[node],node});
distb[node]=curb;
for (auto p:vb[node])
{
if (curb+p.second<distb[p.first])
{
sb.erase({distb[p.first],p.first});
distb[p.first]=curb+p.second;
sb.insert({distb[p.first],p.first});
}
}
if (sb.empty())
return;
nodeb=sb.begin()->second;
for (int i=0;i<9;i++)
SendB(min(distb[nodeb]-curb,511)&(1<<i));
}
void InitB(int n,int b,vector<int> u,vector<int> v,vector<int> c)
{
for (int i=0;i<b;i++)
{
vb[u[i]].push_back({v[i],c[i]});
vb[v[i]].push_back({u[i],c[i]});
}
for (int i=0;i<n;i++)
{
distb.push_back(1e9);
sb.insert({distb[i],i});
}
updb(0);
}
void ReceiveB(bool x)
{
db.push_back(x);
if (!stateb && db.size()==9)
{
addb=0;
for (int i=0;i<9;i++)
addb|=(db[i]<<i);
db.clear();
if (distb[nodeb]<=curb+addb)
{
curb=distb[nodeb];
for (int i=0;i<11;i++)
SendB(nodeb&(1<<i));
updb(nodeb);
}
else
{
curb+=addb;
stateb=1;
}
}
if (stateb && db.size()==11)
{
int node=0;
for (int i=0;i<11;i++)
node|=(db[i]<<i);
db.clear();
stateb=0;
updb(node);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |