Submission #266518

#TimeUsernameProblemLanguageResultExecution timeMemory
266518dolphingarlicTwo Transportations (JOI19_transportations)C++14
0 / 100
559 ms1536 KiB
#include "Azer.h" #include <bits/stdc++.h> using namespace std; namespace { int N, stage = 0, cnt; vector<pair<int, int>> graph[2000]; vector<int> known, shortest; bool visited[2000]; pair<int, int> candidate = {0, 0}; void reset() { known.push_back(candidate.second); visited[candidate.second] = true; shortest[candidate.second] = candidate.first; if (known.size() == N) return; candidate = {10000000, -1}; for (int i : known) { for (pair<int, int> j : graph[i]) if (!visited[j.first]) { candidate = min(candidate, {shortest[i] + j.second, j.first}); } } for (int i = 0; i < 20; i++) SendA((candidate.first & (1 << i)) >> i); cnt = stage = 0; } } // namespace void InitA(int N, int A, vector<int> U, vector<int> V, vector<int> C) { ::N = N; shortest.resize(N); for (int i = 0; i < A; i++) { graph[U[i]].push_back({V[i], C[i]}); graph[V[i]].push_back({U[i], C[i]}); } reset(); } void ReceiveA(bool x) { if (stage == 0) { if (x) { stage++; candidate = {0, 0}; } else { for (int i = 0; i < 11; i++) SendA((candidate.first & (1 << i)) >> i); reset(); } } else if (stage == 1) { candidate.first |= x << cnt++; if (cnt == 20) { stage++; cnt = 0; } } else { candidate.second |= x << cnt++; if (cnt == 11) reset(); } } vector<int> Answer() { return shortest; }
#include "Baijan.h" #include <bits/stdc++.h> using namespace std; namespace { int N, stage = 0, cnt, a_shortest; vector<pair<int, int>> graph[2000]; vector<int> known, shortest; bool visited[2000]; pair<int, int> candidate = {0, 0}; void reset() { known.push_back(candidate.second); visited[candidate.second] = true; shortest[candidate.second] = candidate.first; candidate = {10000000, -1}; for (int i : known) { for (pair<int, int> j : graph[i]) if (!visited[j.first]) { candidate = min(candidate, {shortest[i] + j.second, j.first}); } } cnt = stage = a_shortest = 0; } } // namespace void InitB(int N, int B, vector<int> S, vector<int> T, vector<int> D) { ::N = N; shortest.resize(N); for (int i = 0; i < B; i++) { graph[S[i]].push_back({T[i], D[i]}); graph[T[i]].push_back({S[i], D[i]}); } reset(); } void ReceiveB(bool y) { if (stage == 0) { a_shortest |= y << cnt++; if (cnt == 20) { if (a_shortest > candidate.first) { SendB(1); for (int i = 0; i < 20; i++) SendB((candidate.first & (1 << i)) >> i); for (int i = 0; i < 11; i++) SendB((candidate.second & (1 << i)) >> i); reset(); } else { SendB(0); cnt = 0; candidate = {a_shortest, 0}; stage++; } } } else if (stage == 1) { candidate.second |= y << cnt++; if (cnt == 11) reset(); } }

Compilation message (stderr)

Azer.cpp: In function 'void {anonymous}::reset()':
Azer.cpp:18:22: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |     if (known.size() == N) return;
      |         ~~~~~~~~~~~~~^~~~
#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...