Submission #992626

# Submission time Handle Problem Language Result Execution time Memory
992626 2024-06-04T22:54:11 Z MarwenElarbi Two Transportations (JOI19_transportations) C++17
Compilation error
0 ms 0 KB
//Azer
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pb push_back
vector<pair<int,int>> adja[2005];
int n;
vector<int> ans;
void InitA(int N, int A, std::vector<int> U, std::vector<int> V,std::vector<int> C){
    n=N;
    for (int i = 0; i < A; ++i)
    {
        adja[U[i]].pb({V[i],C[i]});
        adja[V[i]].pb({U[i],C[i]});
    }
}

void ReceiveA(bool x) {
  ans.pb(x);
}

std::vector<int> Answer() {
  vector<int> res;
  for (int i = 0; i < ans.size(); i+=20)
  {
    int cur=0;
    for (int j = 0; j < 20; ++j)
    {
      cur+=((ans[i+j]&1)<<j);
    }
    res.pb(cur);
  }
  return res;
}
//Baijan
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pb push_back
vector<pair<int,int>> adjb[2005];
int n;
void InitB(int N, int B, std::vector<int> S, std::vector<int> T,std::vector<int> D) {
    n=N;
    int dis[n];
    for (int i = 0; i < n; ++i)
    {
      dis[i]=1e9;
      adjb[S[i]].pb({T[i],D[i]});
      adjb[T[i]].pb({S[i],D[i]});
    }
    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 node=pq.top().se;
      int d=pq.top().fi;
      pq.pop();
      if(d!=dis[node]) continue;
      for(auto u:adjb[node]){
        int newd=d+u.se;
        if(newd>dis[u.fi]) continue;
        dis[u.fi]=newd;
        pq.push({newd,u.fi});
      }
    }
    for (int i = 0; i < n; ++i)
    {
      for (int j = 0; j < 20; ++j)
      {
        if((1<<j)&dis[i]) SendB(1);
        else SendB(0);
      }
    }
}

void ReceiveB(bool y){

}

Compilation message

Azer.cpp: In function 'std::vector<int> Answer()':
Azer.cpp:26:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   for (int i = 0; i < ans.size(); i+=20)
      |                   ~~^~~~~~~~~~~~

Baijan.cpp: In function 'void InitB(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Baijan.cpp:38:27: error: 'SendB' was not declared in this scope
   38 |         if((1<<j)&dis[i]) SendB(1);
      |                           ^~~~~
Baijan.cpp:39:14: error: 'SendB' was not declared in this scope
   39 |         else SendB(0);
      |              ^~~~~