Submission #785998

# Submission time Handle Problem Language Result Execution time Memory
785998 2023-07-17T21:46:58 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=0,nu=0;
int k1=0,k2=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(ll i=0;i<g[0].size();i++)
    {
        q.push({g[0][i].st,g[0][i].nd});
    }
    bool y=false;
    q.push({99999999,0});
    bool e=true;
    int ile=0;
    while(q.size()>0 && ile<N)
    {
        if(w[q.top().nd]>0 or(q.top.nd==0 && e))
        {
            q.pop();
        }
        else
        {
            for(int i=0;i<20;i++)
            {
                if(q.top().st&(1<<i))
                {
                    y=true;
                    void SendA(bool y);
                }
                else
                {
                    y=false;
                    void SendA(bool y);
                }
            }
            for(int i=0;i<11;i++)
            {
                if(q.top().nd&(1<<i))
                {
                    y=true;
                    void SendA(bool y);
                }
                else
                {
                    y=false;
                   void SendA(bool y);
                }
            }
            while(k2<11)
            {
            }
            w[nu]=odl;
            ile++;
            for(ll i=0;i<g[nu].size();i++)
            {
                q.push({g[nu][i].nd+odl,g[nu][i].nd});
            }
            if(nu==q.top().nd)
            {
                q.pop();
            }
            k1=0;k2=0;odl=0;nu=0;
        }
        if(ile<N && q.size()==1)
        {    
            e=false;
        }
        if(q.size()>1)
        {
            e=true;
        }
        if(ile==N)
        {
            break;
        }
    }
}
void ReceiveA(bool x)
{
    if(k1<20)
    {
        if(x)
        {
            odl+=pow(2,k1);
        }
        k1++;
    }
    else
    {
        if(x)
        {
            nu+=pow(2,k2);
        }
        k2++;
    }
}
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
typedef long long ll;
int odl=0,nu=0;
int k1=0,k2=0;
void InitB(int N, int B, std::vector<int> S, std::vector<int> T, std::vector<int> D)
{
    vector<vector<pair<int,int>>>g(N);
    vector<int>w(N);
    for(int i=0;i<B;i++)
    {
        g[S[i]].push_back({D[i],T[i]});
        g[T[i]].push_back({D[i],S[i]});
    }
    priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>q;
    for(ll i=0;i<g[0].size();i++)
    {
        q.push({g[0][i].st,g[0][i].nd});
    }
    bool x=false;
    q.push({99999999,0});
    int ile=0;
    bool e=true;
    while(q.size()>0&& ile<N)
    {
        if(w[q.top().nd]>0 or(q.top.nd==0 && e))
        {
            q.pop();
        }
        else
        {
            while(k2<11)
            {
            }
            if(odl>q.top().st)
            {
                odl=q.top().st;
                nu=q.top().st;
            }
           for(int i=0;i<20;i++)
            {
                if(odl&(1<<i))
                {
                    x=true;
                    void SendB(bool x);
                }
                else
                {
                    x=false;
                    void SendB(bool x);
                }
            }
            for(int i=0;i<11;i++)
            {
                if(nu&(1<<i))
                {
                    x=true;
                    void SendB(bool x);
                }
                else
                {
                    x=false;
                    void SendB(bool x);
                }
            }
            w[nu]=odl;
            ile++;
            for(ll i=0;i<g[nu].size();i++)
            {
                q.push({g[nu][i].nd+odl,g[nu][i].nd});
            }
            if(nu==q.top().nd)
            {
                q.pop();
            }
            k1=0;k2=0;odl=0;nu=0;
        }
        if(ile<N && q.size()==1)
        {
            e=false;
        }
        if(q.size()>1)
        {
            e=true;
        }
        if(ile==N)
        {
            break;
        }
    }
}
void ReceiveB(bool x)
{
    if(k1<20)
    {
        if(x)
        {
            odl+=pow(2,k1);
        }
        k1++;
    }
    else
    {
        if(x)
        {
            nu+=pow(2,k2);
        }
        k2++;
    }
}

Compilation message

Azer.cpp: In function 'void InitA(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Azer.cpp:29:17: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(ll i=0;i<g[0].size();i++)
      |                ~^~~~~~~~~~~~
Azer.cpp:39:33: error: invalid use of member function 'std::priority_queue<_Tp, _Sequence, _Compare>::const_reference std::priority_queue<_Tp, _Sequence, _Compare>::top() const [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::const_reference = const std::pair<int, int>&]' (did you forget the '()' ?)
   39 |         if(w[q.top().nd]>0 or(q.top.nd==0 && e))
      |                               ~~^~~
      |                                    ()
Azer.cpp:39:37: error: expected ')' before 'second'
   39 |         if(w[q.top().nd]>0 or(q.top.nd==0 && e))
      |                              ~      ^
      |                                     )
Azer.cpp:42:10: error: expected ')' before 'else'
   42 |         }
      |          ^
      |          )
   43 |         else
      |         ~~~~
Azer.cpp:39:11: note: to match this '('
   39 |         if(w[q.top().nd]>0 or(q.top.nd==0 && e))
      |           ^
Azer.cpp:98:5: error: expected primary-expression before '}' token
   98 |     }
      |     ^
Azer.cpp:33:10: warning: unused variable 'y' [-Wunused-variable]
   33 |     bool y=false;
      |          ^
Azer.cpp:35:10: warning: unused variable 'e' [-Wunused-variable]
   35 |     bool e=true;
      |          ^

Baijan.cpp: In function 'void InitB(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Baijan.cpp:18:17: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(ll i=0;i<g[0].size();i++)
      |                ~^~~~~~~~~~~~
Baijan.cpp:28:33: error: invalid use of member function 'std::priority_queue<_Tp, _Sequence, _Compare>::const_reference std::priority_queue<_Tp, _Sequence, _Compare>::top() const [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::const_reference = const std::pair<int, int>&]' (did you forget the '()' ?)
   28 |         if(w[q.top().nd]>0 or(q.top.nd==0 && e))
      |                               ~~^~~
      |                                    ()
Baijan.cpp:28:37: error: expected ')' before 'second'
   28 |         if(w[q.top().nd]>0 or(q.top.nd==0 && e))
      |                              ~      ^
      |                                     )
Baijan.cpp:31:10: error: expected ')' before 'else'
   31 |         }
      |          ^
      |          )
   32 |         else
      |         ~~~~
Baijan.cpp:28:11: note: to match this '('
   28 |         if(w[q.top().nd]>0 or(q.top.nd==0 && e))
      |           ^
Baijan.cpp:92:5: error: expected primary-expression before '}' token
   92 |     }
      |     ^
Baijan.cpp:22:10: warning: unused variable 'x' [-Wunused-variable]
   22 |     bool x=false;
      |          ^
Baijan.cpp:25:10: warning: unused variable 'e' [-Wunused-variable]
   25 |     bool e=true;
      |          ^