Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Google Code Jamの話 / About Google Code Jam
Search
Linus_MK
April 14, 2018
Programming
550
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Google Code Jamの話 / About Google Code Jam
2018年4月14日 第39回 PORTもくもく会LTにて発表
同日開催されたGoogle Code Jamについてしゃべりました。
Linus_MK
April 14, 2018
Transcript
11 slides
Google Code Jamの話 @Linus_MK 2018年4月14日 第39回 PORTもくもく会
自己紹介 twitter : @Linus_MK (ライナス) 音声信号処理のソフト開発 主にC/C++ 業務外: 機械学習の勉強はじめました 競技プログラミング(Ruby)←今日はこの話!
目次 Google Code Jamとは何か 実際にどんな問題が出てくるのか?
Google Code Jamとは何か 競技プログラミングの大会。Google主催、年1回 アルゴリズム系の問題が出題されて、時間内に解く (解くためのソースコードを書いて、システム上に提出する) システム上で正しいか判定して、正答ならば得点が入る 得点で順位をつける(同点なら提出が速い人が上位) →速く正確にコードを書く必要がある
各ラウンドとスケジュール 予選ラウンド 4月7日(土)08:00 – 4月8日(日)11:00 ラウンド1-A 4月14日(土) 10:00 – 12:30【今日でした】 ラウンド1-B 4月30日(月)
01:00 – 03:30 ラウンド1-C 5月5日(土) 18:00 – 20:30 ラウンド2 ラウンド3 決勝 8月 トロント(カナダ) 25 / 100点取れればOK (14000人が進出した) どれかの回で上位1500位以内 (4500人) 1000位以内 25位以内 ここまではネット上で開催される
今日の結果 ラウンド1-A 4月14日(土) 10:00 – 12:30 の俺 ラウンド1-C 5月5日(土) 18:00 – 20:30 でがんばります……
全然分からん (3問中1問も解けず)
どんな問題が出るの? 予選ラウンド(全4問)の最初の問題を紹介します (適宜省略したので正確なとこは原文を参照)
問題内容 宇宙からロボットが攻めてきた 以下のプログラムで攻撃してくる SとCからなる文字列 S(shoot):攻撃してダメージを与える C(charge):与えるダメージを2倍にする(最初は1) 例:S C C S S ダメージ4 ダメージ4 攻撃 ダメージ1
ダメージ 1→2 ダメージ 2→4 合計ダメージ 9
問題内容 防御シールドでDまでのダメージは耐えられる 攻撃プログラムを書き換えてダメージをD以下にしたい 操作:隣りあう文字を入れ替える (SCCSS → SCSCS) 入力:耐えられるダメージD、攻撃プログラム文字列P 出力:ダメージをD以下にするための最小操作回数 S C C S S ダメージ4 ダメージ4
ダメージ1 1→2 2→4 合計ダメージ 9 S C S C S ダメージ2 ダメージ4 ダメージ1 1→2 2→4 合計ダメージ 7
(だいぶアバウトな)解法 Sを最初(左)の方に、Cを最後(右)の方に移動したい 解法: 文字列の一番右側の「CS」を見つけて、「SC」に入れ替える ダメージを再計算 D以下ならOK、結果を出力して終了 Dより大きいならまだダメ、操作回数++ 最初に戻る 正確な方針はGoogleのAnalysisを参照 S C S C S ダメージ2
ダメージ4 ダメージ1 1→2 2→4 合計ダメージ 7 この「CS」を入れ替え るとダメージ2→1 この「CS」を入れ替え るとダメージ4→2
まとめ 競技プログラミングは楽しいよ (Google Code Jam以外にも色々あります。調べてみてね)
More Decks by Linus_MK
See All by Linus_MK
マッシュアップ曲を聞いてビックリしたので、音楽のコードを分析してみた / Examined the Similarity of Two Tunes by Analyzing their Chords
linus_mk
2
1.5k
今年の振り返りと、最近のお悩みの話 / Review of This Year and My Recent Anxiety
linus_mk
0
780
scikit-learnとTFによる実践機械学習7 / Hands-On Machine Learning with Scikit-Learn and TensorFlow 7
linus_mk
0
3.3k
scikit-learnとTFによる実践機械学習4.1-4.2 / Hands-On Machine Learning with Scikit-Learn and TensorFlow 4.1-4.2
linus_mk
0
1.3k
Other Decks in Programming
See All in Programming
AI駆動TDD ― 2026年10月版
hrmstrsmgs
0
110
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
3
660
Crash Auto Pipelines
veronikapj
1
450
The Cost of the DOM
ypresto
2
210
Kotlin Fest 2026: Kotlin コンパイラに Contribute してみよう! - Kotlin/Wasm で深い再帰を書けるようにした話
ternbusty
1
420
Claude Codeのおかげでやりたいことがやれるようになったんだよォー!
sms_tech
0
190
数行の変更でDockerビルドを最大91%高速化~GitLab CIの実行基盤を社内40リポジトリに展開するまで~
picopico
2
270
テストだけで見つかる? Rubyでつくるメソッド発掘器
izawa
0
160
Debian JP Projectのサーバー構成
uwabami
1
180
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
180
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
360
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
180
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
57
15k
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
830
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
670
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Skip the Path - Find Your Career Trail
mkilby
1
300
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
500
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
1.1k
So, you think you're a good person
axbom
PRO
2
2.3k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
400
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
490
Intergalactic Javascript Robots from Outer Space
tanoku
273
28k
Web Performance Is a Journey [PerfNow 2026]
tammyeverts
2
150