Enviar pesquisa
Carregar
yukicoder : No.269 見栄っ張りの募金活動
•
0 gostou
•
1,814 visualizações
K
kmjp
Seguir
yukicoder : No.269 見栄っ張りの募金活動
Leia menos
Leia mais
Software
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 7
Baixar agora
Baixar para ler offline
Recomendados
yukicoder : No.195 フィボナッチ数列の理解(2)
yukicoder : No.195 フィボナッチ数列の理解(2)
kmjp
Indeedなう A日程 解説
Indeedなう A日程 解説
AtCoder Inc.
yukicoder : No.139 交差点
yukicoder : No.139 交差点
kmjp
yukicoder : No.140 みんなで旅行
yukicoder : No.140 みんなで旅行
kmjp
yukicoder : No.161 制限ジャンケン
yukicoder : No.161 制限ジャンケン
kmjp
AtCoder Beginner Contest 005 解説
AtCoder Beginner Contest 005 解説
AtCoder Inc.
AtCoder Beginner Contest 004 解説
AtCoder Beginner Contest 004 解説
AtCoder Inc.
競技プログラミングでの線型方程式系
競技プログラミングでの線型方程式系
tmaehara
Recomendados
yukicoder : No.195 フィボナッチ数列の理解(2)
yukicoder : No.195 フィボナッチ数列の理解(2)
kmjp
Indeedなう A日程 解説
Indeedなう A日程 解説
AtCoder Inc.
yukicoder : No.139 交差点
yukicoder : No.139 交差点
kmjp
yukicoder : No.140 みんなで旅行
yukicoder : No.140 みんなで旅行
kmjp
yukicoder : No.161 制限ジャンケン
yukicoder : No.161 制限ジャンケン
kmjp
AtCoder Beginner Contest 005 解説
AtCoder Beginner Contest 005 解説
AtCoder Inc.
AtCoder Beginner Contest 004 解説
AtCoder Beginner Contest 004 解説
AtCoder Inc.
競技プログラミングでの線型方程式系
競技プログラミングでの線型方程式系
tmaehara
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
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Mais conteúdo relacionado
Destaque
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
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Destaque
(20)
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
yukicoder : No.269 見栄っ張りの募金活動
1.
yukicoder No. 269 見栄っ張りの募金活動 出題/解説
kmjp 1
2.
問題 • クラスにいるN人の生徒が順にお金を 非負整数円寄付する • 2番目以降の生徒は、直前の生徒より K円以上多く寄付する •
クラス合計金額がS円となる各生徒の 寄付金額の組み合わせは何通りか? 2
3.
想定誤解法 • 𝑓 𝑖,
𝑥, 𝑇 := 生徒𝑖の寄付が𝑥円で、生徒𝑖まで の合計金額が𝑇 円となる組み合わせ総数 – 生徒番号が0-originとして𝑓 𝑁 − 1,∗, 𝑆 の和が解 • 𝑓 𝑖, 𝑥, 𝑇 は生徒(𝑖 − 1)が(𝑥 − 𝐾)円以下を払っ た場合から遷移できるので • このDPは計算量𝛰(𝑁𝑆3)なので当然TLE 𝑓 𝑖, 𝑥, 𝑇 = 𝑓(𝑖 − 1, 𝑗, 𝑇 − 𝑥) 𝑗≤𝑥−𝐾 3
4.
考察 • 生徒𝑖以降は、最低でも生徒𝑖と同額を寄付する • つまり、生徒𝑖が金額を1円増やすと以降の生徒も最 低1円多く寄付するため、クラス全体としては (𝑁
− 𝑖)円多く寄付することが確定する • 生徒𝑖まで金額を決めた場合のクラス合計確定金額 に着目すると、「生徒𝑖が何円払うか」を状態とし て管理しなくてよくなる – 生徒𝑖が払う金額はクラス合計確定金額に考慮済み – 生徒 𝑖 + 1 の金額を考えるときは「生徒𝑖の金額に何円上 乗せするか」だけ考えればよい 4
5.
解法(1) • 𝑔 𝑖,
𝑇 := 生徒𝑖の金額が決まったとき、(以降の生 徒が最低同額払うとして)クラス合計確定金額が𝑇 円となる組み合わせ数 – TLE解と違い、生徒𝑖の金額𝑥がない点に注目 • 以下のDPで𝑔 𝑁 − 1, 𝑆 を求める 𝑔 𝑖, 𝑇 = 𝑔 𝑖 − 1, 𝑇 − 𝐾(𝑁 − 𝑖) + 𝑔(𝑖, 𝑇 − 𝑁 − 𝑖 ) – 生徒𝑖が1円増やすのはクラスで(𝑁 − 𝑖)円増やすのと 同義、ということを意識する 5 生徒iが生徒(i-1)よりちょうど K円多く寄付するケース 生徒iが寄付金をもう1円 追加するケース
6.
解法(2) • 図で書くとこんな感じ 6 3 5
9 11 15 18 0 5 10 15 20 0 1 2 3 4 5 生徒番号 𝑓 3,11,28 += 𝑓 2, 9,17 TLE解法のDPイメージ 3 5 9 11 15 18 0 5 10 15 20 0 1 2 3 4 5 生徒番号 𝑔 3,40 += 𝑔 2, 34 想定解法のDPイメージ 生 徒 の 寄 付 金 額 生 徒 の 寄 付 金 額 3番の生徒が2番より2円多く払う =クラスで6円多く払うと同じ クラスの合計金額 確定分
7.
元ネタ・所感 • 単調増加な数列に対するナップサック 問題に使えそうなテク – 過去にCodeforcesで見かけて感動したので、 応用してみたかった •
本問題では生徒が1回ずつしか寄付しませ んが、生徒に何周か寄付させれば総額を 吊り上げられますね 7
Baixar agora