競技プログラミング用の C++ ライブラリ
#include "src/base/type_alias.hpp"コンテスト用の短い型名です。<bits/stdc++.h> を include します。
vl a(n); // std::vector<long long>
vvl dp(h, vl(w)); // 2次元
heap_min<pl> pq; // 小さい順に取り出す priority_queue
al<3> t; // std::array<long long, 3>
| 別名 | 実体 |
|---|---|
ll / ull / ld
|
long long / unsigned long long / long double
|
str |
std::string |
vec<T> / vv<T> / vvv<T>
|
1 / 2 / 3 次元の std::vector<T>
|
ary<T, N> |
std::array<T, N> |
pl / pd
|
pair<ll, ll> / pair<ld, ld>
|
heap_max<T> / heap_min<T>
|
大きい順 / 小さい順に取り出す std::priority_queue<T>
|
deque、list、map、multimap、multiset、pair、set は std:: なしで使えます。
| 別名 | 実体 |
|---|---|
vl / vvl / vvvl
|
ll の 1 / 2 / 3 次元 vector |
vi / vc / vb / vs / vd
|
int / char / bool / str / ld の vector |
vp<T1, T2> / vpl / vvpl / vpd
|
pair の vector |
val<N> |
vec<al<N>> |
| 別名 | 実体 |
|---|---|
al<N> / aal<N1, N2>
|
ary<ll, N> / ary<ary<ll, N2>, N1>
|
avl<N> / asl<N>
|
ary<vl, N> / ary<sl, N>
|
ml<T> / mll
|
map<ll, T> / map<ll, ll>
|
sl / spl / sal<N>
|
set<ll> / set<pl> / set<al<N>>
|
#pragma once
/**
* @file type_alias.hpp
* @brief 型の別名
*/
#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T>
using vec = std::vector<T>;
template <typename T, int N>
using ary = std::array<T, N>;
using str = std::string;
using std::deque;
using std::list;
using std::map;
using std::multimap;
using std::multiset;
using std::pair;
using std::set;
using pl = pair<ll, ll>;
using pd = pair<ld, ld>;
template <typename T>
using vv = vec<vec<T>>;
template <typename T>
using vvv = vec<vec<vec<T>>>;
using vl = vec<ll>;
using vvl = vv<ll>;
using vvvl = vvv<ll>;
using vs = vec<str>;
using vc = vec<char>;
using vi = vec<int>;
using vb = vec<bool>;
template <typename T1, typename T2>
using vp = vec<pair<T1, T2>>;
using vpl = vec<pl>;
using vvpl = vv<pl>;
using vd = vec<ld>;
using vpd = vec<pd>;
template <int N>
using al = ary<ll, N>;
template <int N1, int N2>
using aal = ary<ary<ll, N2>, N1>;
template <int N>
using val = vec<al<N>>;
template <int N>
using avl = ary<vl,N>;
template <typename T>
using ml = std::map<ll, T>;
using mll = std::map<ll, ll>;
using sl = std::set<ll>;
using spl = set<pl>;
template <int N>
using sal = set<al<N>>;
template <int N>
using asl = ary<sl,N>;
template <typename T>
using heap_max = std::priority_queue<T, std::vector<T>, std::less<T>>;
template <typename T>
using heap_min = std::priority_queue<T, std::vector<T>, std::greater<T>>;#line 2 "src/base/type_alias.hpp"
/**
* @file type_alias.hpp
* @brief 型の別名
*/
#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T>
using vec = std::vector<T>;
template <typename T, int N>
using ary = std::array<T, N>;
using str = std::string;
using std::deque;
using std::list;
using std::map;
using std::multimap;
using std::multiset;
using std::pair;
using std::set;
using pl = pair<ll, ll>;
using pd = pair<ld, ld>;
template <typename T>
using vv = vec<vec<T>>;
template <typename T>
using vvv = vec<vec<vec<T>>>;
using vl = vec<ll>;
using vvl = vv<ll>;
using vvvl = vvv<ll>;
using vs = vec<str>;
using vc = vec<char>;
using vi = vec<int>;
using vb = vec<bool>;
template <typename T1, typename T2>
using vp = vec<pair<T1, T2>>;
using vpl = vec<pl>;
using vvpl = vv<pl>;
using vd = vec<ld>;
using vpd = vec<pd>;
template <int N>
using al = ary<ll, N>;
template <int N1, int N2>
using aal = ary<ary<ll, N2>, N1>;
template <int N>
using val = vec<al<N>>;
template <int N>
using avl = ary<vl,N>;
template <typename T>
using ml = std::map<ll, T>;
using mll = std::map<ll, ll>;
using sl = std::set<ll>;
using spl = set<pl>;
template <int N>
using sal = set<al<N>>;
template <int N>
using asl = ary<sl,N>;
template <typename T>
using heap_max = std::priority_queue<T, std::vector<T>, std::less<T>>;
template <typename T>
using heap_min = std::priority_queue<T, std::vector<T>, std::greater<T>>;