Submission #786029

# Submission time Handle Problem Language Result Execution time Memory
786029 2023-07-17T22:47:26 Z jamkel Two Transportations (JOI19_transportations) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
typedef long long ll;
int odl_a=0,nu_a=0;
int k1a=0,k2a=0;
int n;
vector<int>w(2000);
vector<int>Answer()
{
    vector<int>v(n);
    for(int i=0;i<n;i++)
    {
        v[i]=w[i];
    }
    return v;
}
void InitA(int N, int A, std::vector<int> U, std::vector<int> V, std::vector<int> C)
{
    vector<vector<pair<int,int>>>g(N);
    n=N;
    for(int i=0;i<A;i++)
    {
        g[U[i]].push_back({C[i],V[i]});
        g[V[i]].push_back({C[i],U[i]});
    }
    priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>q;
    for(long unsigned int i=0;i<g[0].size();i++)
    {
        q.push({g[0][i].st,g[0][i].nd});
    }
    q.push({1048575,0});
    bool e=true;
    int ile=1;
    if(q.size()==1)
    {
        e=false;
    }
    while(ile<N)
    {
        if(w[q.top().nd]>0 or(q.top().nd==0 && e))
        {
            q.pop();
        }
        else
        {
            for(int i=0;i<20;i++)
            {
                SendA(q.top().st&(1<<i));
            }
            for(int i=0;i<11;i++)
            {
               SendA(q.top().nd&(1<<i));
            }
            while(k2a<11)
            {
            }
            w[nu_a]=odl_a;
            ile++;
            for(long unsigned int i=0;i<g[nu_a].size();i++)
            {
                q.push({g[nu_a][i].st+odl_a,g[nu_a][i].nd});
            }
            k1a=0;k2a=0;odl_a=0;nu_a=0;
        }
        if(q.size()==1)
        {    
            e=false;
        }
        if(q.size()>1)
        {
            e=true;
        }
    }
}
void ReceiveA(bool x)
{
    if(k1a<20)
    {
        if(x)
        {
            odl_a+=pow(2,k1a);
        }
        k1a++;
    }
    else
    {
        if(x)
        {
            nu_a+=pow(2,k2a);
        }
        k2a++;
    }
}



    

Compilation message

Azer.cpp: In function 'void InitA(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Azer.cpp:50:17: error: 'SendA' was not declared in this scope
   50 |                 SendA(q.top().st&(1<<i));
      |                 ^~~~~
Azer.cpp:54:16: error: 'SendA' was not declared in this scope
   54 |                SendA(q.top().nd&(1<<i));
      |                ^~~~~

/usr/bin/ld: /tmp/ccthPsXJ.o: in function `main':
grader_baijan.cpp:(.text.startup+0x174): undefined reference to `InitB(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: grader_baijan.cpp:(.text.startup+0x202): undefined reference to `ReceiveB(bool)'
collect2: error: ld returned 1 exit status