Skip to content

Commit a4fa7f7

Browse files
committed
switch to auto
1 parent 0b1c9d4 commit a4fa7f7

File tree

15 files changed

+43
-47
lines changed

15 files changed

+43
-47
lines changed

library/graphs/complement_graph_ccs.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
//! cc in the compliment graph
1414
//! @time O(n + m)
1515
//! @space O(n)
16-
template<class G>
17-
vi get_complement_graph_ccs(const G& adj) {
16+
vi get_complement_graph_ccs(const auto& adj) {
1817
int n = sz(adj);
1918
vi cc_id(n), unseen(n);
2019
iota(all(unseen), 0);

library/graphs/dijkstra.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
//! d[v] = min dist from source->..->v
1111
//! @time O(n + (m log m))
1212
//! @space O(n + m)
13-
template<class G>
14-
vector<ll> dijkstra(const G& adj, int s) {
13+
vector<ll> dijkstra(const auto& adj, int s) {
1514
using p = pair<ll, int>;
1615
priority_queue<p, vector<p>, greater<>> pq;
1716
pq.emplace(0, s);

library/graphs/hopcroft_karp.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
//! mvc_r[r] is 1 if r in Min Vertex Cover
1919
//! @time O(n + m * sqrt(n)) n = lsz + rsz
2020
//! @space O(n)
21-
template<class G> struct hopcroft_karp {
21+
struct hopcroft_karp {
2222
int m_sz = 0;
2323
vi to_r, to_l;
2424
vector<bool> mvc_l, mvc_r;
25-
hopcroft_karp(const G& adj, int rsz):
25+
hopcroft_karp(const auto& adj, int rsz):
2626
to_r(sz(adj), -1), to_l(rsz, -1) {
2727
int lsz = sz(adj);
2828
while (1) {

library/strings/manacher/is_palindrome.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#include "manacher.hpp"
33
//! @time O(n + q)
44
//! @space O(n)
5-
template<class T> struct pal_query {
5+
struct pal_query {
66
vi man;
7-
pal_query(const T& s): man(manacher(s)) {};
7+
pal_query(const auto& s): man(manacher(s)) {};
88
bool is_pal(int l, int r) { // [l, r]
99
return man[l + r] <= l;
1010
}

library/strings/manacher/longest_from_index.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//! is a palindrome
99
//! @time O(n)
1010
//! @space O(n)
11-
template<class T> vi longest_from_index(pal_query<T>& pq) {
11+
vi longest_from_index(pal_query& pq) {
1212
int n = (sz(pq.man) + 1) / 2;
1313
vector longest(n, n - 1);
1414
for (int i = n - 2; i >= 0; i--) {

library/strings/manacher/longest_palindrome_query.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
#include "manacher.hpp"
44
//! queries for longest palindromic substring of a given
55
//! substring
6-
template<class T> struct longest_pal_query {
6+
struct longest_pal_query {
77
vi man;
88
RMQ<int, function<int(int, int)>> rmq = {{}, NULL};
99
//! @param s string/vector
1010
//! @time O(n log n)
1111
//! @space O(n log n) for rmq, everything else is O(n)
12-
longest_pal_query(const T& s): man(manacher(s)) {
12+
longest_pal_query(const auto& s): man(manacher(s)) {
1313
vi init(sz(man));
1414
iota(all(init), 0);
1515
rmq = {init, [&](int i1, int i2) {

library/strings/manacher/manacher.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//!
1717
//! @time O(n)
1818
//! @space O(n)
19-
template<class T> vi manacher(const T& s) {
19+
vi manacher(const auto& s) {
2020
int n = sz(s), p = 0;
2121
vi man(2 * n - 1);
2222
rep(i, 0, 2 * n - 1) {

library/strings/suffix_array/suffix_array.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
//!
3535
//! @time O(nlogn + max_num)
3636
//! @space O(n + max_num)
37-
template<class T>
38-
array<vi, 3> get_sa(const T& s, int max_num) {
37+
auto get_sa(const auto& s, int max_num) {
3938
int n = sz(s);
4039
vi sa(n), sa_inv(all(s)), lcp(n - 1);
4140
iota(all(sa), 0);
@@ -67,5 +66,5 @@ array<vi, 3> get_sa(const T& s, int max_num) {
6766
sz++;
6867
lcp[sa_inv[i] - 1] = sz;
6968
}
70-
return {sa, sa_inv, lcp};
69+
return tuple{sa, sa_inv, lcp};
7170
}

library/strings/suffix_array/suffix_array_short.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//! runs in ~1.5s for 5e5
1111
//! @time O(n * log^2(n))
1212
//! @space O(n)
13-
template<class T> array<vi, 3> sa_short(const T& s) {
13+
auto sa_short(const auto& s) {
1414
int n = sz(s);
1515
vi sa(n), sa_inv(all(s)), lcp(n - 1);
1616
iota(all(sa), 0);
@@ -33,5 +33,5 @@ template<class T> array<vi, 3> sa_short(const T& s) {
3333
sz++;
3434
lcp[sa_inv[i] - 1] = sz;
3535
}
36-
return {sa, sa_inv, lcp};
36+
return tuple{sa, sa_inv, lcp};
3737
}

library/trees/ladder_decomposition/linear_kth_par.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
//! kth_par = a node k edges up from v
1313
//! @time O(n + q)
1414
//! @space O(n)
15-
template<class G> struct linear_kth_par {
15+
struct linear_kth_par {
1616
struct node {
1717
int d, p = -1, dl, idx_j, idx_l;
1818
};
1919
vector<node> t;
2020
vector<pii> j;
2121
vi l;
22-
linear_kth_par(const G& adj): t(sz(adj)), j(2 * sz(t)) {
22+
linear_kth_par(const auto& adj):
23+
t(sz(adj)), j(2 * sz(t)) {
2324
vi st;
2425
int pos = 1;
2526
auto add_j = [&]() -> void {

0 commit comments

Comments
 (0)