Submission #472349

#TimeUsernameProblemLanguageResultExecution timeMemory
472349flappybirdTwo Transportations (JOI19_transportations)C++14
0 / 100
477 ms640 KiB
#include "Azer.h" #include <bits/stdc++.h> using namespace std; typedef int ll; namespace { ll N, A; vector<ll> dis, chk; vector<ll> U, V, C; ll cnt = 0; ll c, v; ll pmv; ll pmn; ll pv; ll res; ll mode = 0; ll mv; ll val; void send(ll, ll); void func(); void send(ll x, ll a) { ll i; for (i = a - 1; i >= 0; i--) SendA(x & (1 << i)); } void func() { ll i; ll mn = 1010101010; mv = -1; ll asdfsdf = 0; for (i = 0; i < N; i++) { if (chk[i] == 0) asdfsdf = 1; } if (!asdfsdf) return; for (i = 0; i < A; i++) { if (chk[U[i]] ^ chk[V[i]]) { if (chk[U[i]]) { if (mn > dis[U[i]] + C[i]) mn = dis[U[i]] + C[i], mv = V[i]; } else { if (mn > dis[V[i]] + C[i]) mn = dis[V[i]] + C[i], mv = U[i]; } } } val = min(511, mn - pv); send(mn - pv, 9); } } // namespace void ReceiveA(bool x) { res *= 2; if (x) res++; cnt++; if (mode == 0) { if (cnt == 9) { cnt = 0; if (val <= res) { send(mv, 11); dis[mv] = val + pv; pv = dis[mv]; chk[mv] = 1; res = 0; func(); } else mode = 1, val = res, res = 0; } } else { if (cnt == 11) { dis[res] = val + pv; pv = dis[res]; chk[res] = 1; cnt = 0; mode = 0; res = 0; func(); } } } std::vector<int> Answer() { return dis; } void InitA(int _N, int _A, vector<ll> _U, vector<ll> _V, vector<ll> _C) { tie(N, A, U, V, C) = make_tuple(_N, _A, _U, _V, _C); dis.resize(N); chk.resize(N); ll i; for (i = 1; i < N; i++) dis[i] = 1010101010; chk[0] = 1; mode = 0; res = 0; func(); }
#include "Baijan.h" #include <bits/stdc++.h> using namespace std; typedef int ll; namespace { ll N, B; ll cnt = 0; vector<ll> S, T, D; ll res = 0; ll pv = 0; ll mode; vector<ll> chk; vector<ll> dis; ll val; ll mv; void send(ll x, ll a) { ll i; for (i = a - 1; i >= 0; i--) SendB(x & (1 << i)); } void func() { ll i; ll mn = 1010101010; mv = -1; for (i = 0; i < B; i++) { if (chk[S[i]] ^ chk[T[i]]) { if (chk[S[i]]) { if (mn > dis[S[i]] + D[i]) mn = dis[S[i]] + D[i], mv = T[i]; } else { if (mn > dis[T[i]] + D[i]) mn = dis[T[i]] + D[i], mv = S[i]; } } } val = min(511, mn - pv); } } // namespace void InitB(int _N, int _B, vector<int> _S, vector<int> _T, vector<int> _D) { tie(N, B, S, T, D) = make_tuple(_N, _B, _S, _T, _D); ll i; dis.resize(N); chk.resize(N); for (i = 1; i < N; i++) dis[i] = 1010101010; chk[0] = 1; mode = 0; res = 0; } void ReceiveB(bool y) { res *= 2; if (y) res++; cnt++; if (!mode) { if (cnt == 9) { func(); send(val, 9); cnt = 0; if (val < res) { send(mv, 11); dis[mv] = pv + val; pv = dis[mv]; chk[mv] = 1; res = 0; } else mode = 1, val = res, res = 0; } } else { if (cnt == 11) { cnt = 0; dis[res] = val + pv; pv = dis[res]; chk[res] = 1; mode = 0; res = 0; } } }

Compilation message (stderr)

Azer.cpp:13:5: warning: '{anonymous}::pmn' defined but not used [-Wunused-variable]
   13 |  ll pmn;
      |     ^~~
Azer.cpp:12:5: warning: '{anonymous}::pmv' defined but not used [-Wunused-variable]
   12 |  ll pmv;
      |     ^~~
Azer.cpp:11:8: warning: '{anonymous}::v' defined but not used [-Wunused-variable]
   11 |  ll c, v;
      |        ^
Azer.cpp:11:5: warning: '{anonymous}::c' defined but not used [-Wunused-variable]
   11 |  ll c, v;
      |     ^
#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...