This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;
#define s second
#define f first
const int mxn=2005;
int n;
vector<pair<int,int>> adj[mxn];
vector<int> d(mxn,1e9);
int tmp=0;
int a,b=0;
int bit=0;
int cur=0;
int u,v,c;
void InitA(int N, int A, std::vector<int> U, std::vector<int> V,
std::vector<int> C) {
n=N;
a=A;
for(int i=0;i<A;i++){
adj[U[i]].push_back({V[i],C[i]});
adj[V[i]].push_back({U[i],C[i]});
}
}
void ReceiveA(bool x) {
if(tmp==0){
if(b<11){
if(x) b+=(1<<bit);
bit++;
return;
}
}
bit=0;
if(b>0){
if(bit<11){
if(x) cur+=(1<<bit);
bit++;
return;
}
u=cur;
bit=cur=0;
if(bit<11){
if(x) cur+=(1<<bit);
bit++;
return;
}
v=cur;
bit=cur=0;
if(bit<9){
if(x) cur+=(1<<bit);
bit++;
return;
}
c=cur;
bit=cur=0;
adj[u].push_back({v,c});
adj[v].push_back({u,c});
b--;
}
if(b==0){
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
d[0]=0;
pq.push({0,0});
while(!pq.empty()){
auto v=pq.top();
pq.pop();
if(d[v.s]!=v.f) continue;
for(auto u:adj[v.s]){
if(d[u.f]>d[v.s]+u.s){
d[u.f]=d[v.s]+u.s;
pq.push({d[u.f],u.f});
}
}
}
}
}
std::vector<int> Answer() {
vector<int> ans(n);
for(int i=0;i<n;i++){
ans[i]=d[i];
}
return ans;
}
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
#define s second
#define f first
const int mxn=2005;
int n;
vector<pair<int,int>> adj[mxn];
int tmp=0;
int a,b=0;
int bit=0;
int cur=0;
int u,v,c;
void InitB(int N, int B, std::vector<int> S, std::vector<int> T,
std::vector<int> D) {
n=N;
b=B;
for(int i=0;i<B;i++){
adj[S[i]].push_back({T[i],D[i]});
//adj[V[i]].push_back({U[i],C[i]});
}
for(int i=0;i<11;i++){
if(b&(1<<i)) SendB(1);
else SendB(0);
}
for(int i=0;i<n;i++){
for(auto v:adj[i]){
for(int j=0;j<11;j++){
if(i&(1<<j)) SendB(1);
else SendB(0);
}
for(int j=0;j<11;j++){
if(v.f&(1<<j)) SendB(1);
else SendB(0);
}
for(int j=0;j<9;j++){
if(v.s&(1<<j)) SendB(1);
else SendB(0);
}
}
}
}
void ReceiveB(bool y) {
for(int i=0;i<n;i++){
for(auto v:adj[i]){
for(int j=0;j<11;j++){
if(i&(1<<j)) SendB(1);
else SendB(0);
}
for(int j=0;j<11;j++){
if(v.f&(1<<j)) SendB(1);
else SendB(0);
}
for(int j=0;j<9;j++){
if(v.s&(1<<j)) SendB(1);
else SendB(0);
}
}
}
}
# | 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... |