답안 #785977

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
785977 2023-07-17T21:01:47 Z jamkel Two Transportations (JOI19_transportations) C++14
컴파일 오류
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;
vector<int>Answer(vector<int>w)
{
    return w;
}
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);
    vector<int>w(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(int i=0;i<g[0].size();i++)
    {
        q.push({g[0][i].st,g[0][i].nd});
    }
    bool y;
    while(q.size()>0)
    {
        if(w[q.top().nd]>0)
        {
            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;
            for(int 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;
        }
    }
    Answer(w);
}
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(int i=0;i<g[0].size();i++)
    {
        q.push({g[0][i].st,g[0][i].nd});
    }
    while(q.size()>0)
    {
        if(w[q.top().nd]>0)
        {
            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))
                {
                    SendB(true);
                }
                else
                {
                    SendB(false);
                }
            }
            for(int i=0;i<11;i++)
            {
                if(nu&(1<<i))
                {
                 SendB(true);
                }
                else
                {
                    SendB(false);
                }
            }
            w[nu]=odl;
            for(int 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;
        }
    }
}
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:22:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(int i=0;i<g[0].size();i++)
      |                 ~^~~~~~~~~~~~
Azer.cpp:41:17: error: expected initializer before '}' token
   41 |                 }
      |                 ^
Azer.cpp:46:17: error: expected initializer before '}' token
   46 |                 }
      |                 ^
Azer.cpp:54:17: error: expected initializer before '}' token
   54 |                 }
      |                 ^
Azer.cpp:59:17: error: expected initializer before '}' token
   59 |                 }
      |                 ^
Azer.cpp:65:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |             for(int i=0;i<g[nu].size();i++)
      |                         ~^~~~~~~~~~~~~

Baijan.cpp: In function 'void InitB(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Baijan.cpp:18:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int i=0;i<g[0].size();i++)
      |                 ~^~~~~~~~~~~~
Baijan.cpp:42:21: error: 'SendB' was not declared in this scope
   42 |                     SendB(true);
      |                     ^~~~~
Baijan.cpp:46:21: error: 'SendB' was not declared in this scope
   46 |                     SendB(false);
      |                     ^~~~~
Baijan.cpp:53:18: error: 'SendB' was not declared in this scope
   53 |                  SendB(true);
      |                  ^~~~~
Baijan.cpp:57:21: error: 'SendB' was not declared in this scope
   57 |                     SendB(false);
      |                     ^~~~~
Baijan.cpp:61:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |             for(int i=0;i<g[nu].size();i++)
      |                         ~^~~~~~~~~~~~~