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;
const int maxn=2010;
const int inf=1e9+7;
vector<pair<int,int>>v[maxn];
vector<int> a, b, c;
int dist[maxn], m, cnt, at;
void dijkstra(){
for(int i=1;i<m;i++) dist[i]=inf;
set<pair<int,int>>s;
for(int i=0;i<m;i++) s.insert({dist[i],i});
while(!s.empty()){
auto f=s.begin();
int u=f->second; s.erase(f);
for(auto p : v[u]){
int viz=p.first, peso=p.second;
if(dist[u]+peso<dist[viz]){
s.erase({dist[viz],viz});
dist[viz]=dist[u]+peso;
s.insert({dist[viz],viz});
}
}
}
}
void InitA(int N, int A, vector<int> U, vector<int> V,vector<int> C){
m=N;
SendA(1);
//if(U.size()+a.size()<m-1) return;
for(int i=0;i<m;i++) v[i].clear();
for(int i=0;i<U.size();i++){
v[U[i]].push_back({V[i],C[i]});
v[V[i]].push_back({U[i],C[i]});
}
for(int i=0;i<a.size();i++){
v[a[i]].push_back({b[i],c[i]});
v[b[i]].push_back({a[i],c[i]});
}
dijkstra();
}
void ReceiveA(bool x) {
if(cnt%11==0) at=0;
int id=(cnt/11);
int k=(cnt%11);
if(x) at+=(1<<k);
if(k==10){
if(id%3==0) a.push_back(at);
if(id%3==1) b.push_back(at);
if(id%3==2) c.push_back(at);
}
cnt++;
}
vector<int> Answer() {
vector<int> ans(m);
for(int i=0;i<m;i++) ans[i]=dist[i];
return ans;
}
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn=2010;
int n;
void InitB(int N, int B, vector<int> S, vector<int> T,vector<int> D){
n=N;
for(int i=0;i<B;i++){
int v=S[i], u=T[i], p=D[i];
for(int k=0;k<11;k++){
if(v&(1<<k)) SendB(1);
else SendB(0);
}
for(int k=0;k<11;k++){
if(u&(1<<k)) SendB(1);
else SendB(0);
}
for(int k=0;k<11;k++){
if(p&(1<<k)) SendB(1);
else SendB(0);
}
}
}
void ReceiveB(bool y) {
}
Compilation message (stderr)
Azer.cpp: In function 'void InitA(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Azer.cpp:31:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | for(int i=0;i<U.size();i++){
| ~^~~~~~~~~
Azer.cpp:35:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
35 | for(int i=0;i<a.size();i++){
| ~^~~~~~~~~
# | 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... |