Submission #786026

# Submission time Handle Problem Language Result Execution time Memory
786026 2023-07-17T22:32:20 Z jamkel Two Transportations (JOI19_transportations) C++14
0 / 100
2 ms 784 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});
    }
    bool y=false;
    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++)
            {
                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(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++;
    }
}
#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(long unsigned int i=0;i<g[0].size();i++)
    {
        q.push({g[0][i].st,g[0][i].nd});
    }
    bool x=false;
    q.push({1048575,0});
    int ile=1;
    bool e=true;
    if(q.size()==1)
    {
        e=false;
    }
    while(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().nd;
            }  
            w[nu]=odl;
            ile++;
            for(long unsigned int i=0;i<g[nu].size();i++)
            {
                q.push({g[nu][i].st+odl,g[nu][i].nd});
            }
            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);
                }
            }
            k1=0;k2=0;odl=0;nu=0;
        }
        if(q.size()==1)
        {
            e=false;
        }
        if(q.size()>1)
        {
            e=true;
        }
    }
}
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:33:10: warning: variable 'y' set but not used [-Wunused-but-set-variable]
   33 |     bool y=false;
      |          ^

Baijan.cpp: In function 'void InitB(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Baijan.cpp:22:10: warning: variable 'x' set but not used [-Wunused-but-set-variable]
   22 |     bool x=false;
      |          ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 400 KB Output is correct
2 Incorrect 2 ms 784 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 784 KB Output isn't correct
2 Halted 0 ms 0 KB -