-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
92 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
template <class T> | ||
struct Graph { | ||
template <class T> struct Graph { | ||
struct Edge { | ||
int to; | ||
T cost; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const vector<pair<int, int>> DIRECTIONS = { | ||
{1, 0}, {0, 1}, {-1, 0}, {0, -1}, // 4方向 | ||
{1, 1}, {-1, 1}, {-1, -1}, {1, -1}, // 斜め | ||
{0, 0}, // 自身 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include <ext/pb_ds/assoc_container.hpp> | ||
#include <ext/pb_ds/tree_policy.hpp> | ||
using namespace __gnu_pbds; | ||
template <class T> using treap = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
template <class T, class S> vector<T> make_vec(size_t n, S x) { return vector<T>(n, x); } | ||
template <class T, class... Ts> auto make_vec(size_t n, Ts... ts) { | ||
return vector<decltype(make_vec<T>(ts...))>(n, make_vec<T>(ts...)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
int get_msb(long long x) { | ||
assert(x != 0); | ||
return 63 - __builtin_clzll(x); | ||
} | ||
int get_lsb(long long x) { | ||
assert(x != 0); | ||
return __builtin_ctzll(x); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,51 @@ | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
#define int long long | ||
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++) | ||
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++) | ||
using Int = long long; | ||
#define REP(i, n) for (Int i = 0, max_i = (n); i < max_i; i++) | ||
#define REPI(i, a, b) for (Int i = (a), max_i = (b); i < max_i; i++) | ||
#define ALL(obj) begin(obj), end(obj) | ||
#define RALL(obj) rbegin(obj), rend(obj) | ||
#define fi first | ||
#define se second | ||
using ii = pair<int, int>; | ||
vector<ii> dirs = { | ||
{1, 0}, {0, 1}, {-1, 0}, {0, -1}, // 4方向 | ||
{1, 1}, {-1, 1}, {-1, -1}, {1, -1}, // 斜め | ||
{0, 0}, // 自身 | ||
}; | ||
template <class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; } | ||
template <class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; } | ||
using ii = pair<Int, Int>; | ||
template <class T> inline bool chmax(T& a, const T& b) { | ||
if (a >= b) return false; | ||
a = b; | ||
return true; | ||
} | ||
template <class T> inline bool chmin(T& a, const T& b) { | ||
if (a <= b) return false; | ||
a = b; | ||
return true; | ||
} | ||
|
||
template <class T> std::ostream& print(std::ostream& out, T const& val) { return (out << val << " "); } | ||
template <class T1, class T2> std::ostream& print(std::ostream& out, std::pair<T1, T2> const& val) { | ||
return (out << "{" << val.first << " " << val.second << "} "); | ||
} | ||
template <template <class, class...> class TT, class... Args> | ||
std::ostream& operator<<(std::ostream& out, TT<Args...> const& cont) { | ||
for (auto&& elem : cont) print(out, elem); | ||
return out; | ||
} | ||
|
||
// debug | ||
template <class T> ostream& operator<<(ostream& s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; } | ||
template <class T> ostream& operator<<(ostream& s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; } | ||
template <class T, class S> ostream& operator<<(ostream& s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; } | ||
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; } | ||
#ifdef _MY_DEBUG | ||
#define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n"; | ||
#define dump(...) \ | ||
cerr << "/* " << #__VA_ARGS__ << " [" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), \ | ||
cerr << "*/\n\n"; | ||
#else | ||
#define dump(...) | ||
#define endl "\n" | ||
#define dump(...) | ||
#endif | ||
void dump_func() { cerr << endl; } | ||
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); } | ||
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { | ||
cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); | ||
} | ||
|
||
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast; | ||
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); | ||
constexpr int MOD = 1000000007; | ||
// *************** TEMPLATE END *************** | ||
struct SetupIO { | ||
SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); } | ||
} setup_io; | ||
// ****************************************************************************************************************** | ||
// **************************************** TEMPLATE END ************************************************************ | ||
// ****************************************************************************************************************** | ||
|
||
signed main() { | ||
} | ||
signed main() {} |