狠狠撸

狠狠撸Share a Scribd company logo
第2回 早稲田大学プログラミングコンテスト


  B: 雨上がり	
  keyword: 貪欲法、動的計画法
問題概要	
?? 一本に続いた道と、途中に水たまりがいくつかあります。
?? 主人公は「一歩」or「二歩」or「三歩」前に進めます。
?? なるだけ水たまりを踏まないようにゴールまで行きたいです。


?? 最適な方法で移動した時、水たまりを踏む数の最小数は?




スタート	
                               ゴール	


                     : 普通の道路	
   : 水たまり
制約	
?? 3 <= 道路長 <= 100
?? スタートとゴールは水たまりではない
解法1 : 貪欲法	
?? 「一歩先」「二歩先」「三歩先」のうちどれかが水たまりでない
    ?? そこに進めばOK




?? 次が全て水たまりなら
   ?? 後続の水たまりを回避したいため、必ず三歩進む
   ?? なるべく前に進んだほうがお得だから。
解法2 : 動的計画法	
?? 現在のマスへは、一つ?三つ前のマスからしか到達できない
?? 位置 p まで最適に移動してくれば、
 その先の最適な移動方法はこれまでの移動方法によらない。

?? なので、位置だけを状態に持てばよく、次の漸化式が成立


?? X[0] = 0
?? X[p] = min(X[p-1], X[p-2], X[p-3]) + R[p]
   ?? R[p] : 位置 p が水たまりなら 1 、そうでないなら 0
統計	
?? First AC : uwi (03:08)


?? 正解数 : 177
   ?? 通した人(/205) : 86%
   ?? ACだった解答(/378) : 47%
Ad

Recommended

WUPC2nd D問題
WUPC2nd D問題
Dai Hamada
?
WUPC2nd 総評
WUPC2nd 総評
Dai Hamada
?
WUPC2nd G問題
WUPC2nd G問題
Dai Hamada
?
顿笔特集
顿笔特集
Dai Hamada
?
修士论文発表资料
修士论文発表资料
Dai Hamada
?
WUPC2nd C問題
WUPC2nd C問題
Dai Hamada
?
WUPC2nd A問題
WUPC2nd A問題
Dai Hamada
?
WUPC2nd I問題
WUPC2nd I問題
Dai Hamada
?
PGConf.dev 2025 参加レポート (JPUG総会併設セミナー2025 発表資料)
PGConf.dev 2025 参加レポート (JPUG総会併設セミナー2025 発表資料)
NTT DATA Technology & Innovation
?
础滨技术共有会2025-06-05冲顿别别辫搁别蝉别补谤肠丑の理解と実践.辫诲蹿
础滨技术共有会2025-06-05冲顿别别辫搁别蝉别补谤肠丑の理解と実践.辫诲蹿
Takuma Oda
?
Vibe Codingを始めよう ?Cursorを例に、ノーコードでのプログラミング体験?
Vibe Codingを始めよう ?Cursorを例に、ノーコードでのプログラミング体験?
iPride Co., Ltd.
?
勉強会_ターミナルコマント?入力迅速化_20250620. pptx. .
勉強会_ターミナルコマント?入力迅速化_20250620. pptx. .
iPride Co., Ltd.
?
Protect Your IoT Data with UbiBot's Private Platform.pptx
Protect Your IoT Data with UbiBot's Private Platform.pptx
ユビボット 株式会社
?
色について.pptx .
色について.pptx .
iPride Co., Ltd.
?
Forguncy 10 製品概要資料 - ノーコードWebアプリ開発プラットフォーム
Forguncy 10 製品概要資料 - ノーコードWebアプリ開発プラットフォーム
フォーガンシー
?
OWASP ASVS5.0 overview 20240607_owaspnagoya
OWASP ASVS5.0 overview 20240607_owaspnagoya
OWASP Nagoya
?
2024 Trend Updates: What Really Works In SEO & Content Marketing
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
?
Storytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
?
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
?
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
?
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
?
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
?
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
?
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
?
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
?
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
?
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
?
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
?
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
?
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
?

More Related Content

Recently uploaded (8)

PGConf.dev 2025 参加レポート (JPUG総会併設セミナー2025 発表資料)
PGConf.dev 2025 参加レポート (JPUG総会併設セミナー2025 発表資料)
NTT DATA Technology & Innovation
?
础滨技术共有会2025-06-05冲顿别别辫搁别蝉别补谤肠丑の理解と実践.辫诲蹿
础滨技术共有会2025-06-05冲顿别别辫搁别蝉别补谤肠丑の理解と実践.辫诲蹿
Takuma Oda
?
Vibe Codingを始めよう ?Cursorを例に、ノーコードでのプログラミング体験?
Vibe Codingを始めよう ?Cursorを例に、ノーコードでのプログラミング体験?
iPride Co., Ltd.
?
勉強会_ターミナルコマント?入力迅速化_20250620. pptx. .
勉強会_ターミナルコマント?入力迅速化_20250620. pptx. .
iPride Co., Ltd.
?
Protect Your IoT Data with UbiBot's Private Platform.pptx
Protect Your IoT Data with UbiBot's Private Platform.pptx
ユビボット 株式会社
?
色について.pptx .
色について.pptx .
iPride Co., Ltd.
?
Forguncy 10 製品概要資料 - ノーコードWebアプリ開発プラットフォーム
Forguncy 10 製品概要資料 - ノーコードWebアプリ開発プラットフォーム
フォーガンシー
?
OWASP ASVS5.0 overview 20240607_owaspnagoya
OWASP ASVS5.0 overview 20240607_owaspnagoya
OWASP Nagoya
?
PGConf.dev 2025 参加レポート (JPUG総会併設セミナー2025 発表資料)
PGConf.dev 2025 参加レポート (JPUG総会併設セミナー2025 発表資料)
NTT DATA Technology & Innovation
?
础滨技术共有会2025-06-05冲顿别别辫搁别蝉别补谤肠丑の理解と実践.辫诲蹿
础滨技术共有会2025-06-05冲顿别别辫搁别蝉别补谤肠丑の理解と実践.辫诲蹿
Takuma Oda
?
Vibe Codingを始めよう ?Cursorを例に、ノーコードでのプログラミング体験?
Vibe Codingを始めよう ?Cursorを例に、ノーコードでのプログラミング体験?
iPride Co., Ltd.
?
勉強会_ターミナルコマント?入力迅速化_20250620. pptx. .
勉強会_ターミナルコマント?入力迅速化_20250620. pptx. .
iPride Co., Ltd.
?
Protect Your IoT Data with UbiBot's Private Platform.pptx
Protect Your IoT Data with UbiBot's Private Platform.pptx
ユビボット 株式会社
?
Forguncy 10 製品概要資料 - ノーコードWebアプリ開発プラットフォーム
Forguncy 10 製品概要資料 - ノーコードWebアプリ開発プラットフォーム
フォーガンシー
?
OWASP ASVS5.0 overview 20240607_owaspnagoya
OWASP ASVS5.0 overview 20240607_owaspnagoya
OWASP Nagoya
?

Featured (20)

2024 Trend Updates: What Really Works In SEO & Content Marketing
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
?
Storytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
?
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
?
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
?
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
?
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
?
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
?
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
?
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
?
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
?
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
?
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
?
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
?
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
?
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
?
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
?
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
?
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
?
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
?
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
?
2024 Trend Updates: What Really Works In SEO & Content Marketing
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
?
Storytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
?
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
?
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
?
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
?
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
?
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
?
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
?
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
?
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
?
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
?
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
?
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
?
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
?
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
?
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
?
Ad

WUPC2nd B問題