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
U76NER
May 16, 2022
Programming
980
0
Share
競プロへの誘 -いざな-
WASD Inc. LT会(仮)
2022-03-25
U76NER
May 16, 2022
More Decks by U76NER
See All by U76NER
JSのクラスの後ろ向きな話
u76ner
0
130
GASええやん
u76ner
1
99
mockdateええやん
u76ner
0
320
Other Decks in Programming
See All in Programming
How We Benchmarked Quarkus: Patterns and anti-patterns
hollycummins
1
180
GNU Makeの使い方 / How to use GNU Make
kaityo256
PRO
16
5.6k
なぜあなたのコードには「コシ」がないのか?〜AI時代に問う、最後まで美味しい設計と戦略〜 #phpconkagawa / phpconkagawa2026
shogogg
0
110
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
970
PHPでバイナリをパースして理解するASN.1
muno92
PRO
0
390
AIと共に生きる技術選定 2026
sgash708
0
120
実用!Hono RPC2026
yodaka
2
290
Cache-moi si tu peux : patterns et pièges du cache en production - Devoxx France 2026 - Conférence
slecache
0
330
t *testing.T は どこからやってくるの?
otakakot
1
890
Back to the roots of date
jinroq
0
650
ついに来た!本格的なマルチクラウド時代の Google Cloud
maroon1st
0
360
Terraform言語の静的解析 / static analysis of Terraform language
wata727
1
130
Featured
See All Featured
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
270
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
240
Building Flexible Design Systems
yeseniaperezcruz
330
40k
The Language of Interfaces
destraynor
162
26k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.3k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
120
Scaling GitHub
holman
464
140k
Building Adaptive Systems
keathley
44
3k
Context Engineering - Making Every Token Count
addyosmani
9
860
Building an army of robots
kneath
306
46k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
190
Transcript
競プロへの誘 -いざな- LT会(仮) 2022/03/25 u76ner
競プロとは 2 - 競プロとは - 「競技プログラミング」の略 - 競技プログラミングでは、参加者全員に同一の課題が出題され、より早く与えら れた要求を満足するプログラムを正確に記述することを競う。
(Wikipedia)
競プロとは 3 - 有名なやつの例 - AtCoder
競プロとは 4 - 有名なやつの例 - AIZU ONLINE JUDGE(AOJ)
競プロとは 5 - 問題の入力に対して解答に制限時間内に解答する - だいたい2秒とかが多い気がする(↓ AtCoderでの例)
競プロとは 6 - 問題の入力に対して解答に制限時間内に解答する
競プロとは 7 - 問題の入力に対して解答に制限時間内に解答する - 問題を解くこと自体は原理的にできるが、 ナイーブに実装すると現実的な時間で解くことが不可能 であることが多い
計算量の例 8 - 例) - a n+2 = a n+1
+ a n , a 1 = 1, a 2 = 1 - このとき、a 40 , a 100 を求めよ - いわゆるフィボナッチ数列
計算量の例 9 - ナイーブな実装
計算量の例 10 - ナイーブな実装 - a 100 が計算できない
- 計算時間 - a 40 : 604 ms - a 45 : 6,808 ms - a 50 : > 1 min
計算量の例 11 - 改善点 - a 50 = a
49 + a 48 = (a 48 + a 47 ) + (a 47 + a 46 ) = (a 47 + a 46 ) + (a 46 + a 45 ) + (a 46 + a 45 ) + (a 45 + a 44 ) = …
計算量の例 12 - 改善点 - a 50 = a
49 + a 48 = (a 48 + a 47 ) + (a 47 + a 46 ) = (a 47 + a 46 ) + (a 46 + a 45 ) + (a 46 + a 45 ) + (a 45 + a 44 ) = … - 重複した計算を上手く記憶しておくことで速くできそう
計算量の例 13 - 途中計算を記憶しておく実装
計算量の例 14 - 途中計算を記憶しておく実装 - 計算時間 -
a 40 : ≒ 1ms - a 100 : ≒ 1ms - ちなみにこういうアルゴリズムを総称して動的計画法(DP)という
エンジニアの視点から 15 - 競プロをやることの利点
エンジニアの視点から 16 - 競プロをやることの利点 - 処理を軽くすることに目が向きやすい
エンジニアの視点から 17 - 例)
エンジニアの視点から 18 - ナイーブにやる - 二重ループは改善できそう
エンジニアの視点から 19 - 連想配列を使う -
二重ループが解消できる
まとめ 20 - 競プロでは、計算方法自体はすぐわかるけど、 それを現実的な時間で計算できるかが求められる - 普段の実装でも、細かい計算量の削減に目が行き届くようになる
21