제출 #1122405

#제출 시각아이디문제언어결과실행 시간메모리
1122405SofiatpcTwo Transportations (JOI19_transportations)C++14
8 / 100
714 ms27544 KiB
#include "Azer.h"
#include <bits/stdc++.h>

namespace {
    int n, f, p, a,b,c, dist[2005];
    std::vector<int> adj[2005], w[2005];
}

void InitA(int N, int a, std::vector<int> u, std::vector<int> v, std::vector<int> c) {
    for(int i = 0; i < a; i++){
        ::adj[u[i]].push_back(v[i]);
        ::w[u[i]].push_back(c[i]);
        ::adj[v[i]].push_back(u[i]);
        ::w[v[i]].push_back(c[i]);
    }
    ::n = N;
    ::f = 0; ::p = 0;
    ::a = 0; ::b = 0; ::c = 0;
}

void ReceiveA(bool x) {
    if(f == 0 && p == 11){f = 1; p = 0;}
    if(f == 1 && p == 11){f = 2; p = 0;}
    if(f == 2 && p == 9){
        adj[a].push_back(b); adj[b].push_back(a);
        w[a].push_back(c); w[b].push_back(c);
        f = 0; p = 0;
        a = 0; b = 0; c = 0;
    }

    if(f == 0){
        if(x)a += (1<<p);
        p++;
    }else if(f == 1){
        if(x)b += (1<<p);
        p++;
    }else{
        if(x)c += (1<<p);
        p++;
    }
}

std::vector<int> Answer() {
    adj[a].push_back(b); adj[b].push_back(a);
    w[a].push_back(c); w[b].push_back(c);

    for(int i = 0; i < n; i++)dist[i] = 1e6+5;

    std::set< std::pair<int,int>> st;
    dist[0] = 0;
    st.insert({dist[0],0});
    while(!st.empty()){
        int x = st.begin()->second; st.erase(st.begin());
        for(int i = 0; i < (int)adj[x].size(); i++){
            int viz = adj[x][i], p = w[x][i];
            if(dist[viz] > dist[x] + p){
                st.erase({dist[viz],viz});
                dist[viz] = dist[x]+p;
                st.insert({dist[viz],viz});
            }
        }
    }

    std::vector<int> ans(n);
    for(int i = 0; i < n; i++) {
        ans[i] = dist[i];
    }
    return ans;
}
#include "Baijan.h"
#include <bits/stdc++.h>

namespace {
}  // namespace

void InitB(int N, int b, std::vector<int> s, std::vector<int> t, std::vector<int> d) {
    for(int i = 0; i < b; i++){
        for(int j = 0; j < 11; j++){
            if(s[i] & (1<<j)) SendB(1);
            else SendB(0);
        }

        for(int j = 0; j < 11; j++){
            if(t[i] & (1<<j)) SendB(1);
            else SendB(0);
        }

        for(int j = 0; j < 9; j++){
            if(d[i] & (1<<j)) SendB(1);
            else SendB(0);
        }
    }
}

void ReceiveB(bool y) {

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...