Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
競プロライブラリ紹介
Search
matumoto
March 12, 2022
Technology
0
14
競プロライブラリ紹介
2022/3月に行われた全国学生エンジニア交流会での発表資料です
イベントページはこちら
https://zli.connpass.com/event/239501/
matumoto
March 12, 2022
Tweet
Share
More Decks by matumoto
See All by matumoto
sync/v2 プロポーザルの 背景と sync.Pool について
matumoto
0
53
Goトランザクション処理
matumoto
0
36
いまいちどスライスの 挙動を見直してみる
matumoto
0
330
Go1.22のリリース予定の機能を見る
matumoto
0
62
GoのUnderlying typeについて
matumoto
0
190
Typed-nilについて
matumoto
0
290
GoのType Setsという概念
matumoto
0
23
GoのRateLimit処理の実装
matumoto
0
330
Webプッシュ通知触ってみた
matumoto
0
31
Other Decks in Technology
See All in Technology
ビズリーチが挑む メトリクスを活用した技術的負債の解消 / dev-productivity-con2025
visional_engineering_and_design
2
5.3k
React開発にStorybookとCopilotを導入して、爆速でUIを編集・確認する方法
yu_kod
1
120
PO初心者が考えた ”POらしさ”
nb_rady
0
180
2025-07-06 QGIS初級ハンズオン「はじめてのQGIS」
kou_kita
0
140
より良いプロダクトの開発を目指して - 情報を中心としたプロダクト開発 #phpcon #phpcon2025
bengo4com
1
3.2k
さくらのIaaS基盤のモニタリングとOpenTelemetry/OSC Hokkaido 2025
fujiwara3
2
300
怖くない!はじめてのClaude Code
shinya337
0
340
整頓のジレンマとの戦い〜Tidy First?で振り返る事業とキャリアの歩み〜/Fighting the tidiness dilemma〜Business and Career Milestones Reflected on in Tidy First?〜
bitkey
1
11k
「クラウドコスト絶対削減」を支える技術—FinOpsを超えた徹底的なクラウドコスト削減の実践論
delta_tech
4
110
Delegating the chores of authenticating users to Keycloak
ahus1
0
130
生成AI時代の開発組織・技術・プロセス 〜 ログラスの挑戦と考察 〜
itohiro73
1
410
事業成長の裏側:エンジニア組織と開発生産性の進化 / 20250703 Rinto Ikenoue
shift_evolve
PRO
2
16k
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Documentation Writing (for coders)
carmenintech
72
4.9k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.4k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
46
9.6k
Bash Introduction
62gerente
614
210k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
5.9k
Thoughts on Productivity
jonyablonski
69
4.7k
Gamification - CAS2011
davidbonilla
81
5.3k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Transcript
競プロライブラリを紹介 matumoto
自己紹介 • HN:matumoto • 学部 2 年(新3年) • 所属:Zli、競技プログラミング、企画開発部 •
趣味:漫画、YouTube、競技プログラミング • AtCoder:水 • GitHub:matumoto1234 • Twitter:@matumoto_1234
ライブラリを紹介したい!
作ったはいいものの... • 使わないものが多い • たまにバグっている • 素で書いた方が早い • 柔軟性が少ない •
使い方を覚えていない 紹介して供養 🙏
https://github.com/matumoto1234/library GitHubリポジトリ
データ構造
二分探索を構造体にしたもの • is_valid 関数と範囲を受け取ると二分探索する • 一番使っていない • 素で書いた方が早い • 実は既に消してしまった
dynamic_imos • imos 法の範囲が大きくなったバージョン • 1 <= value <= 1e9
https://github.com/matumoto1234/library/blob/main/data-structure/dynamic-imos.hpp
imos 法とは? 0 1 2 1 ~ 6 5 ~
10 12 ~ 17 2 ~ 12 3 4 5 6 7 8 9 10 11 12 13 14 17 15 16 区間の重なりを知りたい!
区間の重なり 0 1 2 1 ~ 6 5 ~ 10
12 ~ 16 2 ~ 12 3 4 5 6 7 8 9 10 11 12 13 14 17 15 16 5 には 3 つの区間が重なってる 11 には 1 つの区間が重なってる => 区間の長さ × 区間の長さに比例してしまう
区間の重なり 0 1 2 +1 3 4 5 6 7
8 9 10 11 12 13 14 17 15 16 -1 +1 -1 +1 -1 +1 -1
区間の重なり 0 1 2 +1 3 4 5 6 7
8 9 10 11 12 13 14 17 15 16 -1 +1 -1 +1 -1 +1 -1 区間の長さ + 区間の数にはなった!
tree • 木に関係する操作をまとめた便利なやつ • 最小共通祖先 • レベルアンセスター • 木の直径 https://github.com/matumoto1234/library/blob/main/graph/tree.hpp
tree • 使わない! • 他のそれ専用のライブラリを使ってしまう https://github.com/matumoto1234/library/blob/main/graph/tree.hpp
グラフ系
convert_graph • グリッドグラフを隣接リストにする便利関数 • 隣接しているマスを隣接頂点とする • 迷路とかで使う予定だった https://github.com/matumoto1234/library/blob/main/graph/convert-graph.hpp
convert_graph • 使わない! • 迷路は迷路のままで解いてしまう https://github.com/matumoto1234/library/blob/main/graph/convert-graph.hpp
shortest-hamiltonian-path • 最小ハミルトン経路を解く • 巡回セールスマン問題の親戚 https://github.com/matumoto1234/library/blob/main/graph/shortest-hamiltonian-path.hpp
shortest-hamiltonian-path • 使わない! • 実は shortest-hamiltonian-cycle もある • どっちを使えばいいか悩んでしまう •
使用用途がかなり限定的になっている https://github.com/matumoto1234/library/blob/main/graph/shortest-hamiltonian-path.hpp
数学系
floor div • 切り捨ての整数除算をする https://github.com/matumoto1234/library/blob/main/math/floor-div.hpp
floor div • int 型で割り算すればよいです https://github.com/matumoto1234/library/blob/main/math/floor-div.hpp
is prime • 素数判定をする https://github.com/matumoto1234/library/blob/main/math/is-prime.hpp
is prime • 素数判定だけが必要な問題はほぼないです • 他のライブラリで補える https://github.com/matumoto1234/library/blob/main/math/is-prime.hpp
便利ツール系
stopwatch • 時間を計測してくれる https://github.com/matumoto1234/library/blob/main/tools/stopwatch.hpp
stopwatch • いる? • 性能を試したいときは使うかも https://github.com/matumoto1234/library/blob/main/tools/stopwatch.hpp
sliced • python のスライスがほしかった • array[l:r] で [l, r) の配列がほしい
• sliced(array, l, r) で行う https://github.com/matumoto1234/library/blob/main/tools/sliced.hpp
sliced • わざわざ使わない... • ごめん https://github.com/matumoto1234/library/blob/main/tools/sliced.hpp
おまけ
ありがとうございました!