Submission #707599

# Submission time Handle Problem Language Result Execution time Memory
707599 2023-03-09T13:12:16 Z bin9638 Two Transportations (JOI19_transportations) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>

#ifndef SKY
#include "Azer.h"
#endif // SKY

using namespace std;
#define N 2010
#define ll long long
#define ii pair<int,int>
#define fs first
#define sc second
#define pb push_back

int n,dem=0,kq[N];
vector<ii>g[N];

#ifdef SKY
void SendA(bool y)
{
    cout<<y<<endl;
}
#endif // SKY

void InitA(int cc, int A, vector<int> U, vector<int> V,  vector<int> C)
{
    n=cc;
    for(int i=0;i<A;i++)
    {
        int u=U[i],v=V[i],L=C[i];
        g[u].pb({L,v});
        g[v].pb({L,u});
        //cout<<u<<" "<<v<<" "<<L<<endl;
    }
}

void ReceiveA(bool x)
{
    if(x==1)
        kq[dem/20]+=(1<<(dem%20));
    dem++;
}

vector<int> Answer()
{
  vector<int> ans(n);
  for(int i=0;i<n;i++)
    ans[i]=kq[i];
    return ans;
}

#ifdef SKY
int main()
{
    freopen("Azer.inp","r",stdin);
    freopen("Azer.out","w",stdout);
    int n,A;
    vector<int>U,V,C;
    cin>>n>>A;
    for(int i=0;i<A;i++)
    {
        int u,v,c;
        cin>>u>>v>>c;
        U.pb(u);
        V.pb(v);
        C.pb(c);
    }
    InitA(n,A,U,V,C);
    for(int i=0;i<80;i++)
    {
        int x;
        cin>>x;
        ReceiveA(x);
    }
    vector<int>ans=Answer();
    for(int i=0;i<n;i++)cout<<ans[i]<<endl;
}
#endif // SKY
#include<bits/stdc++.h>

#ifndef SKY
#include "Azer.h"
#endif // SKY

using namespace std;
#define N 2010
#define ll long long
#define ii pair<int,int>
#define fs first
#define sc second
#define pb push_back

int n,dp[N],ktr[N];
vector<ii>g[N];

#ifdef SKY
void SendB(bool y)
{
    cout<<y<<endl;
}
#endif // SKY

void InitB(int cc, int A, vector<int> U, vector<int> V,  vector<int> C)
{
    n=cc;
    for(int i=0;i<A;i++)
    {
        int u=U[i],v=V[i],L=C[i];
        g[u].pb({L,v});
        g[v].pb({L,u});
        //cout<<u<<" "<<v<<" "<<L<<endl;
    }
    priority_queue<ii>s;
    memset(dp,0x3f3f,sizeof(dp));
    dp[0]=0;
    s.push({0,0});
    while(!s.empty())
    {
        ii cc=s.top();
        s.pop();
        int u=cc.sc,L=-cc.fs;
        if(ktr[u]==1)
            continue;
        ktr[u]=0;
        for(auto v:g[u])
            if(dp[v.sc]>L+v.fs)
            {
                dp[v.sc]=L+v.fs;
                s.push({-dp[v.sc],v.sc});
            }
    }
    for(int i=0;i<n;i++)
        for(int j=0;j<20;j++)
            SendB((dp[i]>>j)&1);
}

void ReceiveB(bool x)
{
}

#ifdef SKY
int main()
{
    freopen("Baijan.inp","r",stdin);
    freopen("Baijan.out","w",stdout);
    int n,A;
    vector<int>U,V,C;
    cin>>n>>A;
    for(int i=0;i<A;i++)
    {
        int u,v,c;
        cin>>u>>v>>c;
        U.pb(u);
        V.pb(v);
        C.pb(c);
    }
    InitB(n,A,U,V,C);
}
#endif // SKY

Compilation message

Azer.cpp: In function 'std::vector<int> Answer()':
Azer.cpp:47:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   47 |   for(int i=0;i<n;i++)
      |   ^~~
Azer.cpp:49:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   49 |     return ans;
      |     ^~~~~~

Baijan.cpp: In function 'void InitB(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Baijan.cpp:56:13: error: 'SendB' was not declared in this scope
   56 |             SendB((dp[i]>>j)&1);
      |             ^~~~~