SlideShare a Scribd company logo
KAIT ONLINE JUDGE
CONTEST #8
神奈川工科大学大学院 情報工学専攻2年
猪狩知也
問題一覧
Div1 Div2
1問目 Cp3: 金策 Cp1: 旅立ち
2問目 Cp4: 爆発 Cp2: 仲間
3問目 Cp5: 襲撃 Cp3: 金策
4問目 Cp6: 封印 Cp4: 爆発
Cp1: 旅立ち
問題概要
・旅に出る前にN人の人に挨拶をしたい
・1日にM人まで挨拶しに行くことが出来る
・全員に挨拶するには合計何日必要か?
解法
切り上げの割り算を実装する
◦ N/Mの切り上げが答えになる
◦ 特に難しい所はないと思います
丁度割り切れる際の処理に注意する
Cp2: 仲間
問題概要
魔法使いtorusを仲間に引き入れたい
仲間になって貰うために持っているカードをプレゼントする
カードに書かれた数字を2進数にした際に全て1ならYes
全て1にならないならNoを出力する
解法
与えられた数のbitが全て1か調べるのもいいが…
どういうときにYesになるかを考えよう
例)
2^8の256は2進数にすると 1 0000 0000 (No)
255を2進数にすると…? 1111 1111!(Yes)
解法
2のN乗-1のみがYesになる
◦ ただし、2の0乗はNo
予め2のN乗-1の配列を用意しておき、比較するだけでよい
Cp3: 金策
問題概要
カレー屋でアルバイトをすることになった
カレーの辛さが50種類もあるので、面倒である
注文されたカレーの辛さ±1ならば同じカレーとして出すことにした
全ての注文をさばくために必要なカレーの種類を求めよ
解法
どういう風に決めると効率いいか?
o - o - o -o o -o
解法
適当
下から
o - o - o -o o -o
o - o - o -o o -o
カレー1 カレー2 カレー3 カレー4
カレー1 カレー2 カレー3
解法
下から順番に貪欲に選んでいく
◦ +1と-1の処理が面倒…
別の形に変形できないか?
解法
条件の変形
◦ ある辛さから+1~-1は同じ辛さとしてみなす
◦ ある辛さから+2は同じ辛さとしてみなす
◦ は同じく扱える
下から順番に辛さを決めて新しいカレーが必要なら増やす
Cp4: 爆発
問題概要
大きな岩があるトンネルのマップが与えられる
一度だけ岩を壊すことが出来る
スタートからゴールに辿りつけるかどうか?
解法
何処の岩を壊すか…?
S
x
x
x
x
x
x
x
x
x
x
g
x
S
x
x
x
x
x
x
x
x
x
x
g
解法
同じ岩に辿りつけるかどうかを考える
◦ スタートとゴールから幅優先探索で辿りつける岩を探す
S
x
x
x
x
x
x
x
x
x
x
g
x
Cp5: 襲撃
問題概要
Gunmarの町に出てきた怪物を倒す
切れ具合がSの剣を持っている
怪物の硬さ以上の切れ具合がないと倒すことが出来ない
怪物を倒すごとに切れ具合が1/3低下する
最短で全ての怪物を倒す際の移動量はいくつか?
解法
Nが小さい所に着目する(N ≦ 12)
◦ 群馬の都市の数は12
Nが小さければ巡回セールスマン問題を解く事が出来る
解法
bitDP
◦ 分からない人は調べてみましょう
dp[既に移動した町][今現在いる町] = 最小移動量
既に移動した町が分かれば切れ具合の値を一意に求められる
切れ具合が不足していたら更新しない
Cp6: 封印
問題概要
N匹いる精霊全てからエネルギーを取得して魔導砲を打ちたい
精霊は座標(x,y,z)にいて、秒速(mvX,mvY,mvZ)で移動する
精霊の移動方向は開始前に(-mvX,-mvY,-mvZ)に変更できる
KAITは全ての精霊を内包する球を生成してエネルギーを得る
最小の球の半径を求めよ
解法
何を求めればいいかを考える
◦ 最も原点からの距離が遠い精霊の距離
◦ 距離=半径になる
◦ (問題では球ですが円で解説します)
解法
精霊の移動方向の決定
◦ どちらに移動させればよいか?
◦ 原点に向かう方向と離れていく方向の2種類
解法
精霊の移動方向の決定
◦ 1秒後の座標を求め、より原点に近い方を使う
◦ 原点を跨いだとしてももう片方はより離れている
解法
動かす秒数の探索
◦ 何秒動かしたときが最小の半径になるかを調べたい
◦ 作られる球の半径は時間が経過するごとにどう変化するか?
解法
動かす秒数の探索
◦ 経過した時刻と半径の長さをグラフにすると凸のグラフ
◦ ( X座標: 経過時間 Y座標:半径の長さ
◦ 半径の長さの最小は凸になっている点
◦ 3分探索で求めることが出来ます

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 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 ChatGPTEverything 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 EngineeringsProduct 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 HealthHow 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.pdfAI 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 CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO 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)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 2024How 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 InsightsSocial 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 2024Trends 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 summary5 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 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 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 IntentGoogle'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 How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime 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 managementThe 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...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
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 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 ChatGPTEverything 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 EngineeringsProduct 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 HealthHow 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.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO 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)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 2024How 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 InsightsSocial 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 2024Trends 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 summary5 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 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 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 IntentGoogle'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 How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe 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...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Kait_online_judge_8