답안 #122835

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
122835 2019-06-29T10:53:47 Z Plurm Two Transportations (JOI19_transportations) C++14
0 / 100
856 ms 55064 KB
#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;

namespace {
    class state{
    public:
        int u;
        int w;
        state(int x, int y) : u(x), w(y) {}
        friend bool operator<(state x, state y){
            return x.w > y.w;
        }
    };
    int N;
    vector<pair<int, int> > g[2048];
    int dist[2048];
    vector<bool> cur;
    void computeShortestPath(){
        memset(dist, 0x3F, sizeof(dist));
        dist[0] = 0;
        priority_queue<state> pq;
        pq.emplace(0,0);
        while(!pq.empty()){
            state cur = pq.top();
            pq.pop();
            for(auto v : g[cur.u]){
                if(dist[v.first] > cur.w + v.second){
                    dist[v.first] = cur.w + v.second;
                    pq.emplace(v.first, dist[v.first]);
                }
            }
        }
    }
    int B = -1;
}

void InitA(int N, int A, vector<int> U, vector<int> V,
           vector<int> C) {
    ::N = N;
    for(int i = 0; i < A; i++){
        g[U[i]].emplace_back(V[i], C[i]);
        g[V[i]].emplace_back(U[i], C[i]);
    }
}

void ReceiveA(bool x) {
    cur.push_back(x);
    if(B == -1 && cur.size() == 10){
        B = 0;
        for(int i = 0; i < 10; i++){
            if(cur[i]) B += 1 << i;
        }
        cur.clear();
        return;
    }
    if(cur.size() % 31 == 0){
        int w = 0;
        for(int i = cur.size()-31; i < cur.size()-22; i++){
            if(cur[i]) w += 1 << (i-cur.size()+31);
        }
        int u = 0;
        for(int i = cur.size()-22; i < cur.size()-11; i++){
            if(cur[i]) u += 1 << (i-cur.size()+22);
        }
        int v = 0;
        for(int i = cur.size()-11; i < cur.size(); i++){
            if(cur[i]) v += 1 << (i-cur.size()+11);
        }
        g[u].emplace_back(v,w);
        g[v].emplace_back(u,w);
    }
    if(cur.size() / 31 == B) computeShortestPath();
}

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

namespace {
    int N;
}

void InitB(int N, int B, std::vector<int> S, std::vector<int> T,
           std::vector<int> D) {
    ::N = N;
    for(int i = 0; i < 10; i++){
        if(B & (1 << i)) SendB(true);
        else SendB(false);
    }
    for(int i = 0; i < B; i++){
        for(int j = 0; j < 9; j++){
            if(D[i] & (1 << j)) SendB(true);
            else SendB(false);
        }
        for(int j = 0; j < 11; j++){
            if(S[i] & (1 << j)) SendB(true);
            else SendB(false);
        }
        for(int j = 0; j < 11; j++){
            if(T[i] & (1 << j)) SendB(true);
            else SendB(false);
        }
    }
}

void ReceiveB(bool y) {
}
/*
4 3 4
0 1 6
2 1 4
2 0 10
1 2 3
3 1 1
3 2 3
3 0 7
 */

Compilation message

Azer.cpp: In function 'void ReceiveA(bool)':
Azer.cpp:59:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = cur.size()-31; i < cur.size()-22; i++){
                                    ~~^~~~~~~~~~~~~~~
Azer.cpp:63:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = cur.size()-22; i < cur.size()-11; i++){
                                    ~~^~~~~~~~~~~~~~~
Azer.cpp:67:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = cur.size()-11; i < cur.size(); i++){
                                    ~~^~~~~~~~~~~~
Azer.cpp:73:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(cur.size() / 31 == B) computeShortestPath();
        ~~~~~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 652 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1224 KB Output is correct
2 Correct 330 ms 1560 KB Output is correct
3 Correct 552 ms 1864 KB Output is correct
4 Correct 856 ms 55064 KB Output is correct
5 Incorrect 409 ms 48160 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 434 ms 1792 KB Output is correct
2 Correct 8 ms 1248 KB Output is correct
3 Incorrect 6 ms 644 KB Wrong Answer [2]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 153 ms 1176 KB Output is correct
2 Correct 426 ms 1328 KB Output is correct
3 Incorrect 123 ms 8320 KB Wrong Answer [2]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 153 ms 1176 KB Output is correct
2 Correct 426 ms 1328 KB Output is correct
3 Incorrect 123 ms 8320 KB Wrong Answer [2]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 153 ms 1176 KB Output is correct
2 Correct 426 ms 1328 KB Output is correct
3 Incorrect 123 ms 8320 KB Wrong Answer [2]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 652 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -