Submission #1227394

#TimeUsernameProblemLanguageResultExecution timeMemory
1227394MarwenElarbiTwo Transportations (JOI19_transportations)C++17
0 / 100
92 ms1072 KiB
#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;
// A
#define fi first
#define se second
namespace {

    int n_a;
    int i=0;
    int j=0;
    int variable_example[2005];
    int count;

}  // namespace

    void InitA(int N, int A, std::vector<int> U, std::vector<int> V,std::vector<int> C) {
      n_a = N;

    }

    void ReceiveA(bool x) {
      variable_example[i]+=(x<<j);
      j++;
      if(j==19){
        i++;j=0;
      }
    }

    std::vector<int> Answer() {
      std::vector<int> ans(n_a);
      for (int k = 0; k < n_a; ++k) {
        ans[k] = variable_example[k];
      }
      return ans;
    }
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
namespace {
    vector<pair<int,int>> adj[2005];
    int dis[2005];
    void djikastra(){
        priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
        pq.push({0,0});
        dis[0]=0;
        while(!pq.empty()){
            int x=pq.top().se;
            int d=pq.top().fi;
            pq.pop();
            if(dis[x]<d) continue;
            for(auto u:adj[x]){
                int cur=u.se+d;
                if(dis[u.fi]<=cur) continue;
                pq.push({cur,u.fi});
                dis[u.fi]=cur;
            }
        }
    }

}  // namespace

    void InitB(int N, int B, std::vector<int> S, std::vector<int> T,std::vector<int> D) {
      for (int i = 0; i < N; ++i)
      {
        dis[i]=1e9;
      }
      for (int i = 0; i < B; ++i)
      {
        adj[S[i]].push_back({T[i],D[i]});
        adj[T[i]].push_back({S[i],D[i]});
      }
      djikastra();
      for (int i = 0; i < N; ++i)
      {
        for (int j = 0; j < 19; ++j)
        {
            SendB((1<<j)&dis[i]);
        }
      }
    }

    void ReceiveB(bool y) {
      return;
    }
#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...