Skip to content

Commit 8218b94

Browse files
committed
trying this speedup
1 parent 3fd132a commit 8218b94

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

library/graphs/strongly_connected_components/offline_incremental_scc.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ vi offline_incremental_scc(vector<array<int, 2>> eds,
1515
int m = sz(eds);
1616
vi ids(n, -1), joins(m, m), idx(m), vs(n), scc_id;
1717
iota(all(idx), 0);
18-
vector<vi> adj;
18+
vector<basic_string<int>> adj;
1919
auto divide_and_conquer = [&](auto&& self, auto el,
2020
auto er, int tl, int tr) {
2121
adj.clear();

library/graphs/strongly_connected_components/scc.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
//! for each edge u -> v: scc_id[u] >= scc_id[v]
88
//! @time O(n + m)
99
//! @space O(n)
10-
struct sccs {
10+
template <class G> struct sccs {
1111
int num_sccs = 0;
1212
vi scc_id;
13-
sccs(const vector<vi>& adj): scc_id(sz(adj), -1) {
13+
sccs(const G& adj) : scc_id(sz(adj), -1) {
1414
int n = sz(adj), timer = 1;
1515
vi tin(n), st;
1616
auto dfs = [&](auto&& self, int v) -> int {

0 commit comments

Comments
 (0)