Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 0 additions & 141 deletions .verify-helper/timestamps.remote.json

This file was deleted.

2 changes: 1 addition & 1 deletion library/data_structures/dsu/kruskal_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
struct kr_tree {
int id;
vi p;
vector<basic_string<int>> adj;
vector<array<int, 2>> adj;
kr_tree(int n): id(n), p(2 * n, -1), adj(2 * n) {}
int find(int v) {
return p[v] < 0 ? v : p[v] = find(p[v]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
//! @time O((n + q) * \alpha(n))
//! @space O(n + q)
UF get_rp_dsu(const vector<array<int, 3>>& rests, int n) {
vector<basic_string<array<int, 2>>> rests_by_len(n + 1);
vector<vector<pii>> rests_by_len(n + 1);
for (auto [l1, l2, len] : rests)
rests_by_len[len] += {l1, l2};
rests_by_len[len].push_back({l1, l2});
UF uf(n);
for (int len = n; len > 0; len--)
for (auto [l1, l2] : rests_by_len[len])
if (uf.join(l1, l2))
rests_by_len[len - 1] += {l1 + 1, l2 + 1};
rests_by_len[len - 1].push_back({l1 + 1, l2 + 1});
return uf;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "../lazy_seg_tree_midpoint.hpp"
struct merge_sort_tree {
int n;
vector<basic_string<int>> tree;
vector<vi> tree;
merge_sort_tree(const vi& a): n(sz(a)), tree(2 * n) {
int pw2 = bit_ceil(size(a));
rep(i, 0, n) tree[(i + pw2) % n + n] = {a[i]};
Expand Down
4 changes: 2 additions & 2 deletions library/data_structures/uncommon/mode_query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const int b = 318; //!< sqrt(1e5)
struct mode_query {
int n;
vi a, cnt, index_into_index;
vector<basic_string<int>> index;
vector<vi> index;
vector<vector<pii>>
mode_blocks; //!< {mode, cnt} of range of blocks
//! @param a compressed array: 0 <= a[i] < n
Expand All @@ -16,7 +16,7 @@ struct mode_query {
vector<pii>((n + b - 1) / b)) {
rep(i, 0, n) {
index_into_index[i] = sz(index[a[i]]);
index[a[i]] += i;
index[a[i]].push_back(i);
}
for (int start = 0; start < n; start += b) {
int mode = a[start];
Expand Down
8 changes: 4 additions & 4 deletions library/data_structures/uncommon/permutation_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ struct perm_tree {
};
vector<node> p;
int root;
vector<basic_string<int>> ch;
vector<vi> ch;
bool touches(int u, int v) {
return p[u].mn_num == p[v].mn_num + p[v].len ||
p[v].mn_num == p[u].mn_num + p[u].len;
}
int allocate(int mn_i, int mn_v, int ln, bool join,
const basic_string<int>& chs) {
const vi& chs) {
p.push_back({mn_i, mn_v, ln, join});
ch.push_back(chs);
return sz(ch) - 1;
Expand All @@ -50,7 +50,7 @@ struct perm_tree {
if (!empty(ch[u]) && touches(ch[u].back(), v)) {
p[u].mn_num = min(p[u].mn_num, p[v].mn_num);
p[u].len += p[v].len;
ch[u] += v;
ch[u].push_back(v);
v = u;
st.pop_back();
continue;
Expand All @@ -73,7 +73,7 @@ struct perm_tree {
break;
}
int min_num = p[v].mn_num;
basic_string<int> chs(1 + sz(st) - idx, v);
vi chs(1 + sz(st) - idx, v);
rep(j, idx, sz(st)) min_num =
min(min_num, p[chs[j - idx] = st[j][0]].mn_num);
v = allocate(l, min_num, i - l + 1, 0, chs);
Expand Down
6 changes: 3 additions & 3 deletions library/graphs/bridges_cuts/block_vertex_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
auto block_vertex_tree(const auto& adj, int num_bccs,
const vi& bcc_id) {
int n = sz(adj);
vector<basic_string<int>> bvt(n + num_bccs);
vector<vi> bvt(n + num_bccs);
vector<bool> vis(num_bccs);
rep(i, 0, n) {
for (auto [_, e_id] : adj[i]) {
int bccid = bcc_id[e_id];
if (!vis[bccid]) {
vis[bccid] = 1;
bvt[i] += bccid + n;
bvt[bccid + n] += i;
bvt[i].push_back(bccid + n);
bvt[bccid + n].push_back(i);
}
}
for (int bccid : bvt[i]) vis[bccid - n] = 0;
Expand Down
5 changes: 3 additions & 2 deletions library/graphs/bridges_cuts/bridge_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
//! @space O(n)
auto bridge_tree(const auto& adj, int num_ccs,
const vi& br_id, const vi& is_br) {
vector<basic_string<int>> tree(num_ccs);
vector<vi> tree(num_ccs);
rep(i, 0, sz(adj)) for (auto [u, e_id] : adj[i]) if (
is_br[e_id]) tree[br_id[i]] += br_id[u];
is_br[e_id]) tree[br_id[i]]
.push_back(br_id[u]);
return tree;
}
4 changes: 2 additions & 2 deletions library/graphs/enumerate_triangles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ void enumerate_triangles(const vector<pii>& edges, int n,
auto f) {
vi deg(n);
for (auto [u, v] : edges) deg[u]++, deg[v]++;
vector<basic_string<int>> adj(n);
vector<vi> adj(n);
for (auto [u, v] : edges) {
if (tie(deg[u], u) > tie(deg[v], v)) swap(u, v);
adj[u] += v;
adj[u].push_back(v);
}
vector<bool> seen(n);
for (auto [u, v] : edges) {
Expand Down
6 changes: 3 additions & 3 deletions library/graphs/functional_graph_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//! @space O(n)
struct func_graph {
vector<pii> root_of;
vector<basic_string<int>> cycle, childs;
vector<vi> cycle, childs;
func_graph(const vi& a): root_of(sz(a)), childs(sz(a)) {
vi state(sz(a));
rep(i, 0, sz(a)) if (!state[i]) {
Expand All @@ -26,15 +26,15 @@ struct func_graph {
cycle.emplace_back();
while (state[u] == 1) {
root_of[u] = {sz(cycle) - 1, sz(cycle.back())};
cycle.back() += u;
cycle.back().push_back(u);
state[u] = 2;
u = a[u];
}
}
int v = i;
while (state[v] == 1) {
root_of[v] = root_of[u];
childs[a[v]] += v;
childs[a[v]].push_back(v);
state[v] = 2;
v = a[v];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ vector<pii> extra_edges(const auto& adj, int num_sccs,
const vi& scc_id) {
if (num_sccs == 1) return {};
int n = sz(adj);
vector<basic_string<int>> scc_adj(num_sccs);
vector<vi> scc_adj(num_sccs);
vector<bool> zero_in(num_sccs, 1);
rep(i, 0, n) for (int u : adj[i]) {
if (scc_id[i] == scc_id[u]) continue;
scc_adj[scc_id[i]] += scc_id[u];
scc_adj[scc_id[i]].push_back(scc_id[u]);
zero_in[scc_id[u]] = 0;
}
vector<bool> vis(num_sccs);
Expand Down
Loading
Loading