제출 #133538

#제출 시각아이디문제언어결과실행 시간메모리
133538mohammedehab2002Two Transportations (JOI19_transportations)C++14
0 / 100
564 ms1504 KiB
#include "Azer.h" #include <bits/stdc++.h> using namespace std; bool rem[2005]; int cura,nodea; vector<int> dista,da; vector<pair<int,int> > va[2005]; set<pair<int,int> > sa; void upda(int node) { assert(!rem[node]); rem[node]=1; 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<11;i++) SendA(nodea&(1<<i)); 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 (da.size()==20) { int node=0,add=0; for (int i=0;i<11;i++) node|=(da[i]<<i); for (int i=0;i<9;i++) add|=(da[i+11]<<i); if (dista[nodea]<cura+add) { cura=dista[nodea]; upda(nodea); } else { cura+=add; upda(node); } da.clear(); } } vector<int> Answer() { return dista; }
#include "Baijan.h" #include <bits/stdc++.h> using namespace std; int curb,nodeb; 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<11;i++) SendB(nodeb&(1<<i)); 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 (db.size()==20) { int node=0,add=0; for (int i=0;i<11;i++) node|=(db[i]<<i); for (int i=0;i<9;i++) add|=(db[i+11]<<i); if (distb[nodeb]<curb+add) { curb=distb[nodeb]; updb(nodeb); } else { curb+=add; updb(node); } db.clear(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...