Did debug, but still not enough
This commit is contained in:
13
Makefile
13
Makefile
@@ -1,7 +1,7 @@
|
|||||||
SHELL = /bin/bash
|
SHELL = /bin/bash
|
||||||
|
|
||||||
# CXX = g++
|
CXX = g++
|
||||||
CXX = clang++
|
# CXX = clang++
|
||||||
|
|
||||||
SRC_DIR = src
|
SRC_DIR = src
|
||||||
GEN_DIR = generator
|
GEN_DIR = generator
|
||||||
@@ -62,7 +62,7 @@ $(BUILD_DIR) $(BUILD_TARGET_DIR) $(BUILD_GEN_DIR) $(BUILD_VAL_DIR) $(BUILD_CHK_D
|
|||||||
|
|
||||||
$(BUILD_TARGET_DIR)/%: $(SRC_DIR)/%/main.cpp | $(BUILD_TARGET_DIR)
|
$(BUILD_TARGET_DIR)/%: $(SRC_DIR)/%/main.cpp | $(BUILD_TARGET_DIR)
|
||||||
@echo "Compiling Solution $< -> $@"
|
@echo "Compiling Solution $< -> $@"
|
||||||
$(CXX) $(CXXFLAGS) -o $@ $<
|
$(CXX) $(CXXFLAGS) -fsanitize=undefined,address -o $@ $<
|
||||||
|
|
||||||
$(BUILD_GEN_DIR)/%: $(GEN_DIR)/%.cpp | $(BUILD_GEN_DIR)
|
$(BUILD_GEN_DIR)/%: $(GEN_DIR)/%.cpp | $(BUILD_GEN_DIR)
|
||||||
@echo "Compiling Generator $< -> $@"
|
@echo "Compiling Generator $< -> $@"
|
||||||
@@ -83,11 +83,14 @@ $(BUILD_IN_DIR)/input%: $(GEN_TO_RUN) | $(BUILD_IN_DIR)
|
|||||||
echo "Using Seed: $$SEED" >&2; \
|
echo "Using Seed: $$SEED" >&2; \
|
||||||
./$(GEN_TO_RUN) $(GENFLAGS) "$$SEED" > $@
|
./$(GEN_TO_RUN) $(GENFLAGS) "$$SEED" > $@
|
||||||
|
|
||||||
$(BUILD_OUT_A_DIR)/$(SOL_A)%.out: $(BUILD_IN_DIR)/input% $(SOL_A_EXE) | $(BUILD_OUT_A_DIR)
|
.PHONY: force
|
||||||
|
force:
|
||||||
|
|
||||||
|
$(BUILD_OUT_A_DIR)/$(SOL_A)%.out: $(BUILD_IN_DIR)/input% $(SOL_A_EXE) force | $(BUILD_OUT_A_DIR)
|
||||||
@echo "--- Running $(SOL_A) (ID: $*) ---"
|
@echo "--- Running $(SOL_A) (ID: $*) ---"
|
||||||
@time ./$(SOL_A_EXE) < $< > $@
|
@time ./$(SOL_A_EXE) < $< > $@
|
||||||
|
|
||||||
$(BUILD_OUT_B_DIR)/$(SOL_B)%.out: $(BUILD_IN_DIR)/input% $(SOL_B_EXE) | $(BUILD_OUT_B_DIR)
|
$(BUILD_OUT_B_DIR)/$(SOL_B)%.out: $(BUILD_IN_DIR)/input% $(SOL_B_EXE) force | $(BUILD_OUT_B_DIR)
|
||||||
@echo "--- Running $(SOL_B) (ID: $*) ---"
|
@echo "--- Running $(SOL_B) (ID: $*) ---"
|
||||||
@time ./$(SOL_B_EXE) < $< > $@
|
@time ./$(SOL_B_EXE) < $< > $@
|
||||||
|
|
||||||
|
|||||||
@@ -20,31 +20,36 @@ int main(int argc, char *argv[]) {
|
|||||||
vector<ll> cnt(n + 1, 0);
|
vector<ll> cnt(n + 1, 0);
|
||||||
for (ll i = 0; i < m; ++i) {
|
for (ll i = 0; i < m; ++i) {
|
||||||
ll s = rnd.next(1uLL, n);
|
ll s = rnd.next(1uLL, n);
|
||||||
|
if(cnt[s] == n-1)
|
||||||
|
{
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
cnt[s]++;
|
cnt[s]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
unordered_map<ll, ll> selected;
|
unordered_map<ll, ll> M;
|
||||||
|
|
||||||
for (ll s = 1; s <= n; ++s) {
|
for (ll s = 1; s <= n; ++s) {
|
||||||
ll k = cnt[s];
|
ll k = cnt[s];
|
||||||
if (k == 0) continue;
|
if (k == 0) continue;
|
||||||
|
|
||||||
selected.clear();
|
M.clear();
|
||||||
|
|
||||||
|
const ll N = n - 1;
|
||||||
for (ll i = 0; i < k; ++i) {
|
for (ll i = 0; i < k; ++i) {
|
||||||
ll range_size = (n - 1) - i;
|
ll R = N - i;
|
||||||
ll j = rnd.next(1uLL, range_size);
|
ll j = rnd.next(1uLL, R);
|
||||||
|
|
||||||
ll val_j = selected.count(j) ? selected[j] : j;
|
ll val_j = M.count(j) ? M[j] : j;
|
||||||
ll val_last =
|
ll val_last = M.count(R) ? M[R] : R;
|
||||||
selected.count(range_size) ? selected[range_size] : range_size;
|
|
||||||
|
M[j] = val_last;
|
||||||
|
|
||||||
ll e = (val_j < s) ? val_j : val_j + 1;
|
ll e = (val_j < s) ? val_j : val_j + 1;
|
||||||
|
|
||||||
double len = rnd.next(eps, 1.0 / eps);
|
double len = rnd.next(eps, 1.0 / eps);
|
||||||
|
|
||||||
println(s, e, len);
|
println(s, e, len);
|
||||||
|
|
||||||
selected[j] = val_last;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <boost/heap/fibonacci_heap.hpp>
|
#include <boost/heap/fibonacci_heap.hpp>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <iostream>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
@@ -90,7 +91,9 @@ class L33 {
|
|||||||
auto nth = S.begin();
|
auto nth = S.begin();
|
||||||
advance(nth, L - 1);
|
advance(nth, L - 1);
|
||||||
|
|
||||||
nth_element(S.begin(), nth, S.end());
|
nth_element(S.begin(), nth, S.end(), [](const KV& A, const KV& B) {
|
||||||
|
return A.second < B.second;
|
||||||
|
});
|
||||||
advance(nth, 1);
|
advance(nth, 1);
|
||||||
|
|
||||||
BLOCK X, Y;
|
BLOCK X, Y;
|
||||||
@@ -108,8 +111,10 @@ class L33 {
|
|||||||
blocks.erase(it_BLIST);
|
blocks.erase(it_BLIST);
|
||||||
|
|
||||||
auto it_ILIST_Y = it_ILIST;
|
auto it_ILIST_Y = it_ILIST;
|
||||||
it_ILIST->second = it_BLIST_Y;
|
if (d01) UB[it_ILIST_Y->first] = it_ILIST_Y;
|
||||||
auto it_ILIST_X = (d01 ? D0 : D1).insert(it_ILIST_Y, {ubx, it_BLIST_X});
|
it_ILIST_Y->second = it_BLIST_Y;
|
||||||
|
|
||||||
|
auto it_ILIST_X = (d01 ? D1 : D0).emplace(it_ILIST_Y, ubx, it_BLIST_X);
|
||||||
|
|
||||||
if (d01) UB[ubx] = it_ILIST_X;
|
if (d01) UB[ubx] = it_ILIST_X;
|
||||||
|
|
||||||
@@ -135,16 +140,75 @@ class L33 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Insert(const KEY& a, const VALUE& b) {
|
void Insert(const KEY& a, const VALUE& b) {
|
||||||
|
// cerr<<"Turn of "<<a<<endl;
|
||||||
|
// for(auto it = D1.begin(); it != D1.end(); it++)
|
||||||
|
// {
|
||||||
|
// auto [val, X] = *it;
|
||||||
|
|
||||||
|
// cerr<<"> "<<get<0>(val)<<' '<<get<1>(val)<<'
|
||||||
|
// '<<get<2>(val)<<endl;
|
||||||
|
|
||||||
|
// for(auto it = X->begin(); it != X->end(); it++)
|
||||||
|
// {
|
||||||
|
// auto [a, val] = *it;
|
||||||
|
// cerr<<">> "<<get<0>(val)<<' '<<get<1>(val)<<'
|
||||||
|
// '<<get<2>(val)<<endl;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// cerr<<"####"<<endl;
|
||||||
|
// for(auto [val, _]: UB)
|
||||||
|
// {
|
||||||
|
// cerr<<"> "<<get<0>(val)<<' '<<get<1>(val)<<'
|
||||||
|
// '<<get<2>(val)<<endl;
|
||||||
|
// }
|
||||||
|
// cerr<<"######"<<endl;
|
||||||
if (ptr.count(a)) {
|
if (ptr.count(a)) {
|
||||||
auto [d01, it_ILIST, it_BLIST, it_B] = ptr[a];
|
auto [d01, it_ILIST, it_BLIST, it_B] = ptr[a];
|
||||||
if (it_B->second <= b) return;
|
if (it_B->second <= b) return;
|
||||||
|
|
||||||
Delete(a);
|
Delete(a);
|
||||||
|
// cerr<<"HERE I DELETE!"<<endl;
|
||||||
}
|
}
|
||||||
|
auto it_UB = UB.lower_bound(b);
|
||||||
|
// if(it_UB == UB.end())
|
||||||
|
// {
|
||||||
|
// cerr<<"Panic!"<<endl;
|
||||||
|
// cerr<<get<0>(b)<<' '<<get<1>(b)<<' '<<get<2>(b)<<endl;
|
||||||
|
// cerr<<UB.size()<<endl;
|
||||||
|
// for(auto [val, _]: UB)
|
||||||
|
// {
|
||||||
|
// cerr<<"> "<<get<0>(val)<<' '<<get<1>(val)<<'
|
||||||
|
// '<<get<2>(val)<<endl;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
assert(it_UB != UB.end());
|
||||||
|
|
||||||
|
// cerr<<"OKKOKOK"<<endl;
|
||||||
|
auto it_ILIST = it_UB->second;
|
||||||
|
// cerr<<"> "<<get<0>(it_UB->first)<<' '<<get<1>(it_UB->first)<<'
|
||||||
|
// '<<get<2>(it_UB->first)<<endl;
|
||||||
|
|
||||||
|
// cerr<<endl;
|
||||||
|
|
||||||
|
// for(auto it = D1.begin(); it != D1.end(); it++)
|
||||||
|
// {
|
||||||
|
// auto [val, X] = *it;
|
||||||
|
|
||||||
|
// cerr<<"> "<<get<0>(val)<<' '<<get<1>(val)<<'
|
||||||
|
// '<<get<2>(val)<<endl;
|
||||||
|
|
||||||
|
// for(auto it = X->begin(); it != X->end(); it++)
|
||||||
|
// {
|
||||||
|
// auto [a, val] = *it;
|
||||||
|
// cerr<<">> "<<get<0>(val)<<' '<<get<1>(val)<<'
|
||||||
|
// '<<get<2>(val)<<endl;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
auto it_ILIST = UB.lower_bound(b)->second;
|
|
||||||
auto it_BLIST = it_ILIST->second;
|
auto it_BLIST = it_ILIST->second;
|
||||||
|
// cerr<<"OKKOKOK"<<endl;
|
||||||
auto it_B = it_BLIST->emplace(it_BLIST->end(), a, b);
|
auto it_B = it_BLIST->emplace(it_BLIST->end(), a, b);
|
||||||
|
// cerr<<"OKKOKOK"<<endl;
|
||||||
|
|
||||||
ptr[a] = {1, it_ILIST, it_BLIST, it_B};
|
ptr[a] = {1, it_ILIST, it_BLIST, it_B};
|
||||||
|
|
||||||
@@ -172,11 +236,18 @@ class L33 {
|
|||||||
tmp.push_back({a, b});
|
tmp.push_back({a, b});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for(auto [a, b]: tmp) cerr<<"KEY: "<<a<<", VALUE: \n";
|
||||||
|
|
||||||
if (u == nullopt) return;
|
if (u == nullopt) return;
|
||||||
|
|
||||||
auto it_BLIST = blocks.emplace(blocks.end(), std::move(tmp));
|
auto it_BLIST = blocks.emplace(blocks.end(), std::move(tmp));
|
||||||
auto it_ILIST = D0.emplace(D0.begin(), u.value(), it_BLIST);
|
auto it_ILIST = D0.emplace(D0.begin(), u.value(), it_BLIST);
|
||||||
|
|
||||||
|
for (auto it = it_BLIST->begin(); it != it_BLIST->end(); it++) {
|
||||||
|
const auto [a, b] = *it;
|
||||||
|
ptr[a] = {0, it_ILIST, it_BLIST, it};
|
||||||
|
}
|
||||||
|
|
||||||
split(0, it_ILIST);
|
split(0, it_ILIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,7 +295,13 @@ class L33 {
|
|||||||
|
|
||||||
auto nth = S.begin();
|
auto nth = S.begin();
|
||||||
std::advance(nth, M - 1);
|
std::advance(nth, M - 1);
|
||||||
std::nth_element(S.begin(), nth, S.end());
|
std::nth_element(S.begin(), nth, S.end(), [](const KV& A, const KV& B) {
|
||||||
|
return A.second < B.second;
|
||||||
|
});
|
||||||
|
|
||||||
|
// cerr<<"DEBUG S!!"<<endl;
|
||||||
|
// for (auto [a, b] : S) cerr<<get<0>(b)<<' '<<get<1>(b)<<'
|
||||||
|
// '<<get<2>(b)<<endl;
|
||||||
|
|
||||||
KV_LIST R(make_move_iterator(nth + 1), make_move_iterator(S.end()));
|
KV_LIST R(make_move_iterator(nth + 1), make_move_iterator(S.end()));
|
||||||
S.resize(M);
|
S.resize(M);
|
||||||
@@ -232,6 +309,17 @@ class L33 {
|
|||||||
VALUE x = R.front().second;
|
VALUE x = R.front().second;
|
||||||
for (auto [a, b] : R) x = min(x, b);
|
for (auto [a, b] : R) x = min(x, b);
|
||||||
|
|
||||||
|
// cerr<<"DEBUG M!! : "<<M<<endl;
|
||||||
|
// cerr<<"DEBUG R!!"<<endl;
|
||||||
|
// for (auto [a, b] : R) cerr<<get<0>(b)<<' '<<get<1>(b)<<'
|
||||||
|
// '<<get<2>(b)<<endl;
|
||||||
|
|
||||||
|
// cerr<<"DEBUG S!!"<<endl;
|
||||||
|
// for (auto [a, b] : S) cerr<<get<0>(b)<<' '<<get<1>(b)<<'
|
||||||
|
// '<<get<2>(b)<<endl;
|
||||||
|
|
||||||
|
// cerr<<endl;
|
||||||
|
|
||||||
BatchPrepend(R);
|
BatchPrepend(R);
|
||||||
|
|
||||||
K_LIST s;
|
K_LIST s;
|
||||||
|
|||||||
100
src/bsb/main.cpp
100
src/bsb/main.cpp
@@ -88,10 +88,14 @@ pair<vector<ll>, vector<ll> > FindPivots(DIST B, vector<ll> S,
|
|||||||
return {P, vector<ll>(W.begin(), W.end())};
|
return {P, vector<ll>(W.begin(), W.end())};
|
||||||
}
|
}
|
||||||
|
|
||||||
pair<DIST, unordered_set<ll> > BMSSP(ll l, vector<ll> S, DIST B, const ADJ_LIST& adj,
|
pair<DIST, unordered_set<ll> > BMSSP(ll l, vector<ll> S, DIST B,
|
||||||
DIST_LIST& dist, const ll k, const ll t) {
|
const ADJ_LIST& adj, DIST_LIST& dist,
|
||||||
|
const ll k, const ll t) {
|
||||||
assert(S.size() <= (1uLL << (l * t)));
|
assert(S.size() <= (1uLL << (l * t)));
|
||||||
|
|
||||||
|
// cerr<<"LEVLE "<<l<<endl;
|
||||||
|
// cerr<<"S: "; for(auto i:S) cerr<<i<<' '; cerr<<endl;
|
||||||
|
|
||||||
if (l == 0) {
|
if (l == 0) {
|
||||||
ll s = S.front();
|
ll s = S.front();
|
||||||
|
|
||||||
@@ -121,7 +125,8 @@ pair<DIST, unordered_set<ll> > BMSSP(ll l, vector<ll> S, DIST B, const ADJ_LIST&
|
|||||||
|
|
||||||
DIST B_ = dist[U.back()];
|
DIST B_ = dist[U.back()];
|
||||||
|
|
||||||
unordered_set<ll> u(make_move_iterator(U.begin()), make_move_iterator(U.end()));
|
unordered_set<ll> u(make_move_iterator(U.begin()),
|
||||||
|
make_move_iterator(U.end()));
|
||||||
|
|
||||||
if (U.size() <= k) return {B, u};
|
if (U.size() <= k) return {B, u};
|
||||||
return {B_, u};
|
return {B_, u};
|
||||||
@@ -130,41 +135,70 @@ pair<DIST, unordered_set<ll> > BMSSP(ll l, vector<ll> S, DIST B, const ADJ_LIST&
|
|||||||
auto [P, W] = FindPivots(B, S, adj, dist, k, t);
|
auto [P, W] = FindPivots(B, S, adj, dist, k, t);
|
||||||
|
|
||||||
const ll M = (1uLL << ((l - 1) * t));
|
const ll M = (1uLL << ((l - 1) * t));
|
||||||
|
|
||||||
|
// cerr<<"M: "<<M<<endl;
|
||||||
|
|
||||||
|
// cerr<<"P"<<' ';
|
||||||
|
// for(auto i:P) cerr<<i<<' ';
|
||||||
|
// cerr<<endl;
|
||||||
|
|
||||||
|
// cerr<<"W"<<' ';
|
||||||
|
// for(auto i:W) cerr<<i<<' ';
|
||||||
|
// cerr<<endl;
|
||||||
|
|
||||||
|
// cerr<<get<0>(B)<<' '<<get<1>(B)<<' '<<get<2>(B)<<endl;
|
||||||
|
|
||||||
L33<ll, DIST> D(M, B);
|
L33<ll, DIST> D(M, B);
|
||||||
for (auto i : P) D.Insert(i, dist[i]);
|
for (auto i : P) D.Insert(i, dist[i]);
|
||||||
|
|
||||||
const ll LIMIT = k * (1uLL << (l * t));
|
const ll LIMIT = k * (1uLL << (l * t));
|
||||||
|
|
||||||
unordered_set<ll> U; DIST B_;
|
// cerr<<"LIMIT: "<<LIMIT<<endl;
|
||||||
|
|
||||||
|
unordered_set<ll> U;
|
||||||
|
DIST B_;
|
||||||
while (U.size() < LIMIT && !D.empty()) {
|
while (U.size() < LIMIT && !D.empty()) {
|
||||||
auto [Bi, Si] = D.Pull();
|
auto [Bi, Si] = D.Pull();
|
||||||
|
// cerr<<get<0>(Bi)<<' '<<get<1>(Bi)<<' '<<get<2>(Bi)<<endl;
|
||||||
|
// cerr<<"Si: "; for(auto i:Si) cerr<<i<<' '; cerr<<endl;
|
||||||
|
|
||||||
auto [Bi_, Ui] = BMSSP(l - 1, Si, Bi, adj, dist, k, t);
|
auto [Bi_, Ui] = BMSSP(l - 1, Si, Bi, adj, dist, k, t);
|
||||||
B_ = Bi_;
|
B_ = Bi_;
|
||||||
|
|
||||||
|
// cerr<<get<0>(Bi_)<<' '<<get<1>(Bi_)<<' '<<get<2>(Bi_)<<endl;
|
||||||
|
// cerr<<"Ui: "; for(auto i:Ui) cerr<<i<<' '; cerr<<endl;
|
||||||
|
|
||||||
unordered_set<ll> K;
|
unordered_set<ll> K;
|
||||||
|
|
||||||
for(auto u : Ui) for(auto [v, len] : adj[u])
|
for (auto u : Ui)
|
||||||
{
|
for (auto [v, len] : adj[u]) {
|
||||||
if(relex(u, dist[u], len, v, dist[v]))
|
// cerr<<u<<' '<<v<<": "<<len<<endl;
|
||||||
{
|
if (relex(u, dist[u], len, v, dist[v])) {
|
||||||
if(Bi <= dist[v] && dist[v] < B) D.Insert(v, dist[v]);
|
// cerr<<"OK!"<<endl;
|
||||||
else if(Bi_ <= dist[v] && dist[v] < Bi) K.insert(v);
|
if (Bi <= dist[v] && dist[v] < B)
|
||||||
|
D.Insert(v, dist[v]);
|
||||||
|
else if (Bi_ <= dist[v] && dist[v] < Bi)
|
||||||
|
K.insert(v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
for (auto s : Si)
|
||||||
for(auto s:Si) if(Bi_ <= dist[s] && dist[s] < Bi)
|
if (Bi_ <= dist[s] && dist[s] < Bi) K.insert(s);
|
||||||
K.insert(s);
|
|
||||||
|
|
||||||
U.merge(Ui);
|
U.merge(Ui);
|
||||||
|
|
||||||
vector<pair<ll, DIST> > K_; K_.reserve(K.size());
|
vector<pair<ll, DIST> > K_;
|
||||||
for(auto k:K) K_.push_back({k, dist[k]});
|
K_.reserve(K.size());
|
||||||
|
for (auto k : K) K_.push_back({k, dist[k]});
|
||||||
|
|
||||||
|
// for(auto [s, _]: K_) cerr<<s<<' ';
|
||||||
|
// cerr<<endl;
|
||||||
|
|
||||||
D.BatchPrepend(K_);
|
D.BatchPrepend(K_);
|
||||||
}
|
}
|
||||||
|
|
||||||
B_ = min(B_, B);
|
B_ = min(B_, B);
|
||||||
for(auto s:W) if(dist[s] < B_) U.insert(s);
|
for (auto s : W)
|
||||||
|
if (dist[s] < B_) U.insert(s);
|
||||||
|
|
||||||
return {B_, U};
|
return {B_, U};
|
||||||
}
|
}
|
||||||
@@ -210,23 +244,31 @@ int main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ll k = floor(pow(log2(2 * m), 1.0 / 3));
|
// for(ll s=1;s<=c;s++) for(auto [i, len]: adj[s]) cerr<<s<<" -> "<<i<<",
|
||||||
const ll t = floor(pow(log2(2 * m), 2.0 / 3));
|
// cost: "<<len<<endl;
|
||||||
|
|
||||||
const ll l = ceil((log2(2 * m) / t));
|
|
||||||
|
|
||||||
const int s = 1;
|
|
||||||
|
|
||||||
// distance,
|
|
||||||
DIST_LIST dist(2 * m + 1, {INF, INF, -1});
|
|
||||||
|
|
||||||
dist[s] = {0, 0, -1};
|
|
||||||
|
|
||||||
const DIST Binf = {INF, -1, -1};
|
const DIST Binf = {INF, -1, -1};
|
||||||
auto [B_, U] = BMSSP(l, {s}, Binf, adj, dist, k, t);
|
DIST_LIST dist(2 * m + 1, Binf);
|
||||||
|
|
||||||
|
if (!renum[1].empty()) {
|
||||||
|
const ll k = floor(pow(log2(2 * m), 1.0 / 3)) + 2;
|
||||||
|
const ll t = floor(pow(log2(2 * m), 2.0 / 3)) + 2;
|
||||||
|
|
||||||
|
const ll l = ceil((log2(2 * m) / t));
|
||||||
|
|
||||||
|
const ll s = renum[1].front();
|
||||||
|
|
||||||
|
// cerr<<"k: "<<k<<" t: "<<t<<" l: "<<l<<endl;
|
||||||
|
|
||||||
|
dist[s] = {0, 0, -1};
|
||||||
|
|
||||||
|
auto [B_, U] = BMSSP(l, {s}, Binf, adj, dist, k, t);
|
||||||
|
}
|
||||||
|
|
||||||
vector<double> ans(n + 1, INF);
|
vector<double> ans(n + 1, INF);
|
||||||
for (ll i = 1; i <= n; i++)
|
ans[1] = 0;
|
||||||
|
|
||||||
|
for (ll i = 2; i <= n; i++)
|
||||||
if (!renum[i].empty()) ans[i] = get<0>(dist[renum[i].front()]);
|
if (!renum[i].empty()) ans[i] = get<0>(dist[renum[i].front()]);
|
||||||
|
|
||||||
cout << fixed << setprecision(15);
|
cout << fixed << setprecision(15);
|
||||||
|
|||||||
Reference in New Issue
Block a user