제출 #1232560

#제출 시각아이디문제언어결과실행 시간메모리
1232560rythm_of_knightTwo Transportations (JOI19_transportations)C++17
6 / 100
267 ms21784 KiB
#include "Azer.h" #include <bits/stdc++.h> #define ar array using namespace std; const int MXN = 2005, inf = 2e6; static int res[MXN], a[MXN][MXN], n; static set <ar <int, 2>> st[MXN]; static vector <int> com; static void add(int x, int d) { vector <int> c(n); for (int i : com) { c[i] = 1; if (a[i][x]) { st[i].erase({res[i] + a[i][x], x}); } } com.push_back(x); c[x] = 1; res[x] = d; for (int i = 0; i < n; i++) { if (!c[i] && a[x][i] > 0) { st[x].insert({res[x] + a[x][i], i}); } } } static int pra = 0, prb = 0, st9 = 9, st11 = 11, db = 0, d, x; static void go() { ar <int, 2> cur = {pra + 505, n + 1}; for (int i : com) if (!st[i].empty()) cur = min(cur, *st[i].begin()); x = cur[1]; d = cur[0] - pra; st9 = st11 = 0; db = 0; for (int i = 0; i < 9; i++) SendA((d >> i) & 1); } void InitA(int N, int A, vector<int> U, vector<int> V, vector<int> C) { n = N; for (int i = 0; i < n; i++) res[i] = n + 1; for (int i = 0; i < A; i++) a[U[i]][V[i]] = a[V[i]][U[i]] = C[i]; add(0, 0); go(); } void ReceiveA(bool bt) { if (st9 < 9) { db |= bt << st9; st9++; if (st9 == 9) { if (min(db, d) > 500) return; db += (db > 500) * inf; d += (d > 500) * inf; db += prb; d += pra; if (d < inf) pra = d; if (db < inf) prb = db; if (d < db) { for (int i = 0; i < 11; i++) SendA((x >> i) & 1); add(x, d); go(); } else { x = 0; } } } else { if (st11 < 11) { x |= bt << st11; st11++; } if (st11 == 11) { add(x, db); go(); } } } vector <int> Answer() { vector<int> ans(n, n + 1); for (int i = 0; i < n; i++) ans[i] = res[i]; return ans; }
#include "Baijan.h" #include <bits/stdc++.h> #define ar array using namespace std; const int MXN = 2005, inf = 2e6; int res[MXN], b[MXN][MXN], n; set <ar <int, 2>> st[MXN]; vector <int> com; void add(int x, int d) { vector <int> c(n); for (int i : com) { c[i] = 1; if (b[i][x]) { st[i].erase({res[i] + b[i][x], x}); } } com.push_back(x); c[x] = 1; res[x] = d; for (int i = 0; i < n; i++) { if (!c[i] && b[x][i]) { st[x].insert({res[x] + b[x][i], i}); } } } int pra = 0, prb = 0, st9 = 9, st11 = 11, da = 0, d, x; void go() { ar <int, 2> cur = {prb + 505, n + 1}; for (int i : com) if (!st[i].empty()) cur = min(cur, *st[i].begin()); x = cur[1]; d = cur[0] - prb; st9 = st11 = 0; da = 0; for (int i = 0; i < 9; i++) SendB((d >> i) & 1); } void InitB(int N, int B, vector<int> S, vector<int> T, vector<int> D) { n = N; for (int i = 0; i < n; i++) res[i] = n + 1; for (int i = 0; i < B; i++) b[S[i]][T[i]] = b[T[i]][S[i]] = D[i]; add(0, 0); go(); } void ReceiveB(bool bt) { if (st9 < 9) { da |= bt << st9; st9++; if (st9 == 9) { if (min(da, d) > 500) return; da += (da > 500) * inf; d += (d > 500) * inf; da += pra; d += prb; if (d < inf) prb = d; if (da < inf) pra = da; if (d <= da) { for (int i = 0; i < 11; i++) SendB((x >> i) & 1); add(x, d); go(); } else { x = 0; } } } else { if (st11 < 11) { x |= bt << st11; st11++; } if (st11 == 11) { add(x, da); go(); } } }
#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...