Submission #565115

#TimeUsernameProblemLanguageResultExecution timeMemory
565115maomao90Two Transportations (JOI19_transportations)C++17
6 / 100
374 ms19516 KiB
// Hallelujah, praise the one who set me free // Hallelujah, death has lost its grip on me // You have broken every chain, There's salvation in your name // Jesus Christ, my living hope #include <bits/stdc++.h> #include "Azer.h" using namespace std; template <class T> inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;} template <class T> inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;} #define REP(i, s, e) for (int i = s; i < e; i++) #define RREP(i, s, e) for (int i = s; i >= e; i--) typedef long long ll; typedef long double ld; #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; typedef tuple<int, int, int> iii; #define ALL(_a) _a.begin(), _a.end() #define pb push_back typedef vector<int> vi; typedef vector<ll> vll; typedef vector<ii> vii; typedef vector<iii> viii; #ifndef DEBUG #define cerr if (0) cerr #endif const int INF = 1000000005; const ll LINF = 1000000000000000005ll; const int MAXN = 200005; namespace { const int NLOG = 11, CLOG = 9; int n, m; vii adj[MAXN]; queue<bool> qu; int vis[MAXN]; vi dist; int get() { int d = 0; REP (i, 0, NLOG + CLOG) { d += qu.front() << i; qu.pop(); } return d; } } void InitA(int N, int A, vi U, vi V, vi C) { n = N; m = A; REP (i, 0, m) { adj[U[i]].pb({V[i], C[i]}); adj[V[i]].pb({U[i], C[i]}); } } void ReceiveA(bool x) { qu.push(x); if (qu.size() == NLOG + CLOG) { dist.pb(get()); } } vi Answer() { return dist; }
// Hallelujah, praise the one who set me free // Hallelujah, death has lost its grip on me // You have broken every chain, There's salvation in your name // Jesus Christ, my living hope #include <bits/stdc++.h> #include "Baijan.h" using namespace std; template <class T> inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;} template <class T> inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;} #define REP(i, s, e) for (int i = s; i < e; i++) #define RREP(i, s, e) for (int i = s; i >= e; i--) typedef long long ll; typedef long double ld; #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; typedef tuple<int, int, int> iii; #define ALL(_a) _a.begin(), _a.end() #define pb push_back typedef vector<int> vi; typedef vector<ll> vll; typedef vector<ii> vii; typedef vector<iii> viii; #ifndef DEBUG #define cerr if (0) cerr #endif const int INF = 1000000005; const ll LINF = 1000000000000000005ll; const int MAXN = 200005; namespace { const int NLOG = 11, CLOG = 9; int n, m; vii adj[MAXN]; bool vis[MAXN]; void send(int d) { REP (i, 0, NLOG + CLOG) { SendB(d >> i & 1); } } } void InitB(int N, int B, vi U, vi V, vi C) { n = N; m = B; REP (i, 0, m) { adj[U[i]].pb({V[i], C[i]}); adj[V[i]].pb({U[i], C[i]}); } vi dist(n, INF); dist[0] = 0; while (1) { int u = -1, d = INF; REP (i, 0, n) { if (vis[i]) continue; if (mnto(d, dist[i])) { u = i; } } if (u == -1) { break; } vis[u] = 1; for (auto [v, w] : adj[u]) { mnto(dist[v], d + w); } } REP (u, 0, n) { send(dist[u]); } } void ReceiveB(bool y) { }

Compilation message (stderr)

Azer.cpp:43:9: warning: '{anonymous}::vis' defined but not used [-Wunused-variable]
   43 |     int vis[MAXN];
      |         ^~~
#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...