Submission #1135340

#TimeUsernameProblemLanguageResultExecution timeMemory
1135340adaawfTwo Transportations (JOI19_transportations)C++20
0 / 100
1 ms1192 KiB
#include <iostream> #include <vector> #include "Azer.h" using namespace std; vector<pair<int, int>> g[2005], gg[2005]; int n, dd[2005], f[2005], cc = 0, hh = 9, d = 0, y, ca = 0; pair<int, pair<int, int>> trya() { int mi = 2e9, h, ma = 0; for (int i = 0; i < n; i++) { if (dd[i] == 1) { ma = max(ma, f[i]); } else { if (mi > f[i]) { mi = f[i]; h = i; } } } return {mi - ma, {ma, h}}; } void send(int x, int y) { if (ca == n) return; if (y == 9) ca++; for (int i = 0; i < y; i++) { if (x & (1 << i)) SendA(1); else SendA(0); } } void InitA(int N, int a, vector<int> u, vector<int> v, vector<int> c) { for (int i = 0; i < u.size(); i++) { g[u[i]].push_back({v[i], c[i]}); g[v[i]].push_back({u[i], c[i]}); } n = N; f[0] = 0; for (int i = 1; i < n; i++) f[i] = 1e9; auto h = trya(); send(h.first, 9); hh = 9; } void update(int d, int x) { f[d] = x; for (auto w : g[d]) { f[w.first] = min(f[d] + w.second, f[w.first]); } } void ReceiveA(bool x) { if (x == 1) d |= (1 << cc); cc++; if (cc == hh) { if (hh == 11) { auto h = trya(); dd[d] = 1; update(d, h.second.first + y); hh = 9; h = trya(); send(h.first, 9); } else { auto h = trya(); if (h.first < d) { send(h.second.second, 11); update(h.second.second, h.second.first + h.first); dd[h.second.second] = 1; h = trya(); send(h.first, 9); } else { hh = 11; y = d; } } cc = d = 0; } } vector<int> Answer() { vector<int> v; for (int i = 0; i < n; i++) v.push_back(f[i]); return v; }
#include <iostream> #include <vector> #include "Baijan.h" using namespace std; vector<pair<int, int>> g[2005], gg[2005]; int n, dd[2005], f[2005], cc = 0, hh = 9, d = 0, y, ca = 0; pair<int, pair<int, int>> trya() { int mi = 2e9, h, ma = 0; for (int i = 0; i < n; i++) { if (dd[i] == 1) { ma = max(ma, f[i]); } else { if (mi > f[i]) { mi = f[i]; h = i; } } } return {mi - ma, {ma, h}}; } void send(int x, int y) { if (ca == n) return; if (y == 9) ca++; for (int i = 0; i < y; i++) { if (x & (1 << i)) SendB(1); else SendB(0); } } void InitB(int N, int a, vector<int> u, vector<int> v, vector<int> c) { for (int i = 0; i < u.size(); i++) { g[u[i]].push_back({v[i], c[i]}); g[v[i]].push_back({u[i], c[i]}); } n = N; f[0] = 0; for (int i = 1; i < n; i++) f[i] = 1e9; auto h = trya(); send(h.first, 9); hh = 9; } void update(int d, int x) { f[d] = x; for (auto w : g[d]) { f[w.first] = min(f[d] + w.second, f[w.first]); } } void ReceiveB(bool x) { if (x == 1) d |= (1 << cc); cc++; if (cc == hh) { if (hh == 11) { auto h = trya(); dd[d] = 1; update(d, h.second.first + y); hh = 9; h = trya(); send(h.first, 9); } else { auto h = trya(); if (h.first < d) { send(h.second.second, 11); update(h.second.second, h.second.first + h.first); dd[h.second.second] = 1; h = trya(); send(h.first, 9); } else { hh = 11; y = d; } } cc = d = 0; } }
#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...