This file contains hidden or 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
肩慣らし | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0021 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0012 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0081 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0079 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1100 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0023 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0153 | |
ライブラリを作ろう/アドホックなのもてきとーに出来るようになろう |
This file contains hidden or 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
#include <bits/stdc++.h> | |
using namespace std; | |
typedef complex<int> P; | |
struct adjacent{ | |
P p; | |
adjacent(const P &p) : p(p){} | |
template<typename ...Args> adjacent(const Args &...args) : p(args...){} | |
struct Iter : public forward_iterator_tag { |
This file contains hidden or 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
#include <bits/stdc++.h> | |
using namespace std; | |
template<typename Res, typename ...Args> struct _memoized{//{{{ | |
function<Res(Args...)> f; | |
map<tuple<Args...>, Res> memo; | |
_memoized(function<Res(Args...)> &f) : f(f){} | |
Res operator()(Args ...args){ | |
const auto &key = make_tuple(args...); |
This file contains hidden or 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
// https://codeiq.jp/ace/kawazoe/q1339 | |
#include <iostream> | |
#include <vector> | |
long long k_bonacci(const int &k, const int &n){ | |
std::vector<long long> v(k, 0); | |
long long res = v.back() = 1; | |
for(int i = 0; i < n; ++i) std::swap(v[i%k] = res * 2 - v[i%k], res); | |
return res; | |
} | |
int main(){ |
This file contains hidden or 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
#include <bits/stdc++.h> | |
#define all(x) begin(x),end(x) | |
#define rall(x) (x).rbegin(),(x).rend() | |
#define REP(i,b,n) for(int i=(int)(b);i<(int)(n);++i) | |
#define rep(i,n) REP(i,0,n) | |
#define repsz(i,v) rep(i,(v).size()) | |
#define aur auto& | |
#define bit(n) (1LL<<(n)) | |
#define eb emplace_back | |
#define mt make_tuple |
This file contains hidden or 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
#include <bits/stdc++.h> | |
using namespace std; | |
namespace KeyWordArguments{//{{{ | |
template<typename T> | |
class KeyWord {//{{{ | |
using type = T; | |
KeyWord(const size_t &id, const T &val) : id(id), val(val) {} | |
static inline size_t get_id(){ static size_t count = 0; return count++; } | |
public: |
This file contains hidden or 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
#include <bits/stdc++.h> | |
#define all(x) begin(x),end(x) | |
#define rall(x) (x).rbegin(),(x).rend() | |
#define REP(i,b,n) for(int i=(int)(b);i<(int)(n);++i) | |
#define rep(i,n) REP(i,0,n) | |
#define repsz(i,v) rep(i,(v).size()) | |
#define aur auto& | |
#define bit(n) (1LL<<(n)) | |
#define eb emplace_back | |
#define mt make_tuple |
This file contains hidden or 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
using ll = long long; | |
// https://gist.github.com/MiSawa/2818cf0bfdb27d42c429f2adb7ee9bc0 | |
// バグってても責任とりません >_< | |
// 下に行くほど最適化が減る代わりに記述が楽になります | |
struct ICPCAugRelabel {//{{{ | |
using Flow = int64_t; | |
constexpr static Flow INF = numeric_limits<Flow>::max(); | |
struct E{ | |
size_t t, rev; |
This file contains hidden or 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
#include <iostream> | |
#include <type_traits> | |
// param > 0 => use param as the modulo | |
// param <= 0 => you can set the modulo with ModInt<param>::set_modulo(...) in runtime. | |
// Of course, those runtime modulo will be distinguished if the param was different. | |
template<int param> | |
class ModInt{//{{{ | |
using Z = int; | |
using N = unsigned int; |
This file contains hidden or 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
#include <iostream> | |
#include <vector> | |
#include <tuple> | |
#include <array> | |
// s u - u - u - u | |
// | > a < X X X > c - t | |
// b v - v - v - v | |