Submission #836330

#TimeUsernameProblemLanguageResultExecution timeMemory
836330unnickTwo Transportations (JOI19_transportations)C++14
8 / 100
450 ms28776 KiB
#include "Azer.h" #include <iostream> #include <vector> #include <queue> using namespace std; typedef struct { int to; int w; } edge_t; namespace { int N; int bit_idx = 0; vector<bool> bits; vector< vector<edge_t> > vts; bool read_bool() { return bits[bit_idx++]; } int read_int(int b) { int x = 0; for (int i = 0; i < b; i++) { x += ((int) read_bool()) << i; } return x; } } // namespace void InitA(int N, int A, std::vector<int> U, std::vector<int> V, std::vector<int> C) { ::N = N; for (int i = 0; i < N; i++) { vector<edge_t> tmp; vts.push_back(tmp); } for (int i = 0; i < A; i++) { vts[U[i]].push_back({.to = V[i], .w = C[i]}); vts[V[i]].push_back({.to = U[i], .w = C[i]}); } } void ReceiveA(bool x) { bits.push_back(x); } std::vector<int> Answer() { while (bit_idx < bits.size()) { int u = read_int(11); int v = read_int(11); int c = read_int(9); vts[u].push_back({.to = v, .w = c}); vts[v].push_back({.to = u, .w = c}); } vector<int> ans(N,2000000000); ans[0] = 0; auto cmp = [](edge_t a, edge_t b){ return a.w>b.w; }; vector<bool> visited(N, false); priority_queue<edge_t, vector<edge_t>, decltype(cmp)> queue(cmp); queue.push({.to=0, .w=0}); while (!queue.empty()) { edge_t e = queue.top(); queue.pop(); if (visited[e.to]) continue; visited[e.to] = true; ans[e.to] = e.w; for (edge_t e2 : vts[e.to]) { // if (visited[e2.to]) continue; e2.w += e.w; queue.push(e2); } } return ans; }
#include "Baijan.h" #include <vector> namespace { // int N; // int count; // bool FunctionExample(bool P) { // return !P; // } void send_int(int x, int b) { for (int i = 0; i < b; i++) { SendB((x>>i)&1); } } } // namespace void InitB(int N, int B, std::vector<int> S, std::vector<int> T, std::vector<int> D) { // ::N = N; // count = 0; for (int i = 0; i < B; i++) { send_int(S[i], 11); send_int(T[i], 11); send_int(D[i], 9); }; } void ReceiveB(bool y) { // ++count; // if (count < 58000) { // SendB(FunctionExample(y)); // ++count; // } }

Compilation message (stderr)

Azer.cpp: In function 'std::vector<int> Answer()':
Azer.cpp:51:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |   while (bit_idx < bits.size()) {
      |          ~~~~~~~~^~~~~~~~~~~~~
#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...