1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

githubでC++のライブラリを公開してます

Last updated at Posted at 2023-08-17

僕が作ったライブラリを公開しています。利用は自由です。作ったときは、この記事に書いていきます。

main.hpp

よく使うものを書いています。

  • rep系
    repは[0,n)
    repsは[s,e)
    rvrepは(n,0] (多分書き方正しくないと思うので、コメントください)
    repvはvector全探索
  • all(x)
    みんなが使っているように、x.begin(), x.end()です。
    sort(all(x))などです。
  • chmax, chmin
    変更されたかどうかを返す

  • llなどです。int→llは使ってません。
  • ac-library
    ac-libraryがあるときにdefineされる何かがあれば教えてください。追加します。
    mintは998244353, mint1は1000000007です。

9/10追記 io.hppに移しました

io.hpp

  • 高速入出力
    IinとLLinとInputです。速度は試してませんが多分速いです
    8/27追記: inputを変更→stringに追加していくのは本当に早いのかと疑い、とりあえずscanfに変更
    しかしメモリをめっちゃ使う。追記終
    IoutとPrintです。いつかマクロでpythonみたいにしたいな。

math/modcomb.hpp

modcombの構造体を作りました。

// verified 2023/08/16
// ABC034 C - 経路
// https://atcoder.jp/contests/abc034/tasks/abc034_c
// https://atcoder.jp/contests/abc034/submissions/44626334
int main() {
  int w = iin(), h = iin();
  mComb c; c.init(200000);
  iout(c.C(w + h - 2, w - 1));
}

こんな感じです。

math/integer.hpp

素数判定、約数列挙、素因数分解、エラトステネスの篩と区間篩、modpow、MillerRabinとPollardRhoなどです。
MillerRabinは失敗率$ \frac 1 {4^{30}} $です。

追加したら書きます

1
1
5

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?