답안 #707600

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
707600 2023-03-09T13:12:58 Z bin9638 Two Transportations (JOI19_transportations) C++17
6 / 100
342 ms 10204 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 "Baijan.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;
      |     ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 307 ms 796 KB Output is correct
2 Correct 2 ms 656 KB Output is correct
3 Correct 313 ms 912 KB Output is correct
4 Correct 316 ms 10204 KB Output is correct
5 Correct 20 ms 912 KB Output is correct
6 Correct 342 ms 2388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 656 KB Output is correct
2 Incorrect 217 ms 856 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 314 ms 908 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 135 ms 680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 135 ms 680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 135 ms 680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 307 ms 796 KB Output is correct
2 Correct 2 ms 656 KB Output is correct
3 Correct 313 ms 912 KB Output is correct
4 Correct 316 ms 10204 KB Output is correct
5 Correct 20 ms 912 KB Output is correct
6 Correct 342 ms 2388 KB Output is correct
7 Correct 1 ms 656 KB Output is correct
8 Incorrect 217 ms 856 KB Output isn't correct
9 Halted 0 ms 0 KB -