Submission #789531

# Submission time Handle Problem Language Result Execution time Memory
789531 2023-07-21T13:14:22 Z someone Two Transportations (JOI19_transportations) C++14
Compilation error
0 ms 0 KB
#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;

struct Arc {
    int nex, pds;
};

const int N = 2e3 + 42, INF = 1e6 + 42;

int n, knows[N];
vector<bool> msg;
vector<int> dist;
vector<Arc> arc[N];
priority_queue<pair<int, int>> pq;

void Init(int X, int a, vector<int> U, vector<int> V, vector<int> C) {
    //cout << '\n' << '\n';
    n = X;
    dist.resize(n);
    for(int i = 0; i < a; i++) {
        arc[U[i]].push_back({V[i], C[i]});
        arc[V[i]].push_back({U[i], C[i]});
    }
    for(int i = 1; i < n; i++)
        knows[i] = dist[i] = INF;
    for(int i = 0; i < n; i++)
        pq.push({-dist[i], i});

    for(int j = 0; j < 11; j++)
        Send(0 & (1 << j));
    for(int j = 0; j < 20; j++)
        Send(0 & (1 << j));
}

void Receive(bool x) {
    msg.push_back(x);
    if(31 == (int)msg.size()) {
        int i = 0, d = 0;
        for(int j = 0; j < 11; j++)
            i += (1 << j) * msg[j];
        for(int j = 0; j < 20; j++)
            d += (1 << j) * msg[j + 11];
        msg.clear();

        if(d < dist[i]) {
            dist[i] = d;
            pq.push({-d, i});
        }
        knows[i] = d;

        bool envoi = false;
        while(!envoi && !pq.empty()) {
            i = pq.top().second,
            d = -pq.top().first;
            pq.pop();
            if(dist[i] == d) {
                for(Arc a : arc[i]) {
                    if(dist[a.nex] > dist[i] + a.pds) {
                        dist[a.nex] = dist[i] + a.pds;
                        pq.push({-dist[a.nex], a.nex});
                    }
                }
                if(knows[i] > d) {
                    //cout << "Azer envoie " << i << ' ' << d << '\n';
                    knows[i] = d;
                    envoi = true;
                    for(int j = 0; j < 11; j++)
                        Send(i & (1 << j));
                    for(int j = 0; j < 20; j++)
                        Send(d & (1 << j));
                }
            }
        }
        if(!envoi)
            for(int j = 0; j < n; j++)
                if(dist[j] == INF) {
                    //cout << "Azer n'envoie rien\n";
                    for(int k = 0; k < 11; k++)
                        Send(j & (1 << k));
                    for(int k = 0; k < 20; k++)
                        Send(INF & (1 << k));
                    j = n;
                }
    }
}

vector<int> Answer() {
    return dist;
}
#include <bits/stdc++.h>
#include "Baijan.h"
using namespace std;

struct Arc {
    int nex, pds;
};

const int N = 2e3 + 42, INF = 1e6 + 42;

int n, knows[N];
vector<int> dist;
vector<Arc> arc[N];
vector<bool> msg;
priority_queue<pair<int, int>> pq;

void Init(int X, int b, vector<int> S, vector<int> T, vector<int> D) {
    n = X;
    dist.resize(n);
    for(int i = 0; i < b; i++) {
        arc[S[i]].push_back({T[i], D[i]});
        arc[T[i]].push_back({S[i], D[i]});
    }
    for(int i = 1; i < n; i++)
        knows[i] = dist[i] = INF;
    for(int i = 0; i < n; i++)
        pq.push({-dist[i], i});
}

void Receive(bool y) {
    msg.push_back(y);
    if(31 == (int)msg.size()) {
        int i = 0, d = 0;
        for(int j = 0; j < 11; j++)
            i += (1 << j) * msg[j];
        for(int j = 0; j < 20; j++)
            d += (1 << j) * msg[j + 11];
        msg.clear();

        if(d < dist[i]) {
            dist[i] = d;
            pq.push({-d, i});
        }
        knows[i] = d;

        bool envoi = false;
        while(!envoi && !pq.empty()) {
            i = pq.top().second,
            d = -pq.top().first;
            pq.pop();
            if(dist[i] == d) {
                for(Arc a : arc[i]) {
                    if(dist[a.nex] > dist[i] + a.pds) {
                        dist[a.nex] = dist[i] + a.pds;
                        pq.push({-dist[a.nex], a.nex});
                    }
                }
                if(knows[i] > d) {
                    knows[i] = d;
                    //cout << "Baijan envoie " << i << ' ' << d << '\n';
                    envoi = true;
                    for(int j = 0; j < 11; j++)
                        Send(i & (1 << j));
                    for(int j = 0; j < 20; j++)
                        Send(d & (1 << j));
                }
            }
        }
        if(!envoi)
            for(int j = 0; j < n; j++)
                if(dist[j] == INF) {
                    //cout << "Baijan n'envoie rien\n";
                    for(int k = 0; k < 11; k++)
                        Send(j & (1 << k));
                    for(int k = 0; k < 20; k++)
                        Send(INF & (1 << k));
                    j = n;
                }
    }
}

Compilation message

Azer.cpp: In function 'void Init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Azer.cpp:31:9: error: 'Send' was not declared in this scope; did you mean 'SendA'?
   31 |         Send(0 & (1 << j));
      |         ^~~~
      |         SendA
Azer.cpp:33:9: error: 'Send' was not declared in this scope; did you mean 'SendA'?
   33 |         Send(0 & (1 << j));
      |         ^~~~
      |         SendA
Azer.cpp: In function 'void Receive(bool)':
Azer.cpp:69:25: error: 'Send' was not declared in this scope; did you mean 'SendA'?
   69 |                         Send(i & (1 << j));
      |                         ^~~~
      |                         SendA
Azer.cpp:71:25: error: 'Send' was not declared in this scope; did you mean 'SendA'?
   71 |                         Send(d & (1 << j));
      |                         ^~~~
      |                         SendA
Azer.cpp:80:25: error: 'Send' was not declared in this scope; did you mean 'SendA'?
   80 |                         Send(j & (1 << k));
      |                         ^~~~
      |                         SendA
Azer.cpp:82:25: error: 'Send' was not declared in this scope; did you mean 'SendA'?
   82 |                         Send(INF & (1 << k));
      |                         ^~~~
      |                         SendA

Baijan.cpp: In function 'void Receive(bool)':
Baijan.cpp:63:25: error: 'Send' was not declared in this scope; did you mean 'SendB'?
   63 |                         Send(i & (1 << j));
      |                         ^~~~
      |                         SendB
Baijan.cpp:65:25: error: 'Send' was not declared in this scope; did you mean 'SendB'?
   65 |                         Send(d & (1 << j));
      |                         ^~~~
      |                         SendB
Baijan.cpp:74:25: error: 'Send' was not declared in this scope; did you mean 'SendB'?
   74 |                         Send(j & (1 << k));
      |                         ^~~~
      |                         SendB
Baijan.cpp:76:25: error: 'Send' was not declared in this scope; did you mean 'SendB'?
   76 |                         Send(INF & (1 << k));
      |                         ^~~~
      |                         SendB