Soumettre la recherche
Mettre en ligne
AOJ0234にみるダイクストラ法の応用
•
2 j'aime
•
1,266 vues
Yuta Ogura
Suivre
ダイクストラ法の頂点を工夫して、ルールを簡単にしよう
Lire moins
Lire la suite
Technologie
Signaler
Partager
Signaler
Partager
1 sur 8
Recommandé
20131023 intersection
20131023 intersection
Nobuyuki Nakata
マイクラ自動化枠第4回資料
マイクラ自動化枠第4回資料
Ryo Fujita
LTspiceを活用した微分回路シミュレーション
LTspiceを活用した微分回路シミュレーション
Tsuyoshi Horigome
K : 解説
K : 解説
Takumi Yamashita
Vinculum
Vinculum
tomerun
K060 中心極限定理clt
K060 中心極限定理clt
t2tarumi
大規模グラフアルゴリズムの最先端
大規模グラフアルゴリズムの最先端
Takuya Akiba
秋のVim祭り Rubyを添えて
秋のVim祭り Rubyを添えて
Yuta Ogura
Recommandé
20131023 intersection
20131023 intersection
Nobuyuki Nakata
マイクラ自動化枠第4回資料
マイクラ自動化枠第4回資料
Ryo Fujita
LTspiceを活用した微分回路シミュレーション
LTspiceを活用した微分回路シミュレーション
Tsuyoshi Horigome
K : 解説
K : 解説
Takumi Yamashita
Vinculum
Vinculum
tomerun
K060 中心極限定理clt
K060 中心極限定理clt
t2tarumi
大規模グラフアルゴリズムの最先端
大規模グラフアルゴリズムの最先端
Takuya Akiba
秋のVim祭り Rubyを添えて
秋のVim祭り Rubyを添えて
Yuta Ogura
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
Contenu connexe
En vedette
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
En vedette
(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...
AOJ0234にみるダイクストラ法の応用
1.
AOJ0234にみる ダイクストラ法の応用 OGURA
2.
2 ダイクストラ法 • 単一始点最短距離 1 3 その他の頂点 15 3 2 コスト(距離) 始点 遠い…
3.
3 2 1 アルゴリズムの内容 1. 始点からの最短距離確定組 vs
未確定組にわける 2. 未確定組の中で最短でいける頂点を確定組の仲間にする 10 15 3 2 始点 その他の頂点 1手目 始点:0, 1:∞, 2:∞, 3:∞ 確定組(始点) • 始点から始点への最短距離は0なので始点を確定組に追加 2手目 始点:0, 1:10, 2:15, 3:∞ 確定組(始点) • 確定組から行ける最短距離を更新する(始点→1,始点→2) 3手目 始点:0, 1:10, 2:15, 3:∞ 確定組(始点,1) • 未確定組の中で始点から最短なやつを確定組に追加 • 確定組から行ける最短距離を更新する(始点→2,1→2) 4手目 始点:0, 1:10, 2:13, 3:∞ 確定組(始点,1) 最短距離 頂点1 : 10 頂点2 : 13 頂点3 : 15 • 未確定組の中で始点から最短なやつを確定組に追加 5手目 始点:0, 1:10, 2:13, 3:∞ 確定組(始点,1,2)
4.
AOJ0234 • 始点がいっぱい • 終点もいっぱい •
ノードの状態が変化 • 条件(空気)がある 始点 (1,1 ) 始点 (2,1 ) 始点 (3,1 ) 始点 (4,1 ) (1,2 ) (1,n ) 終点 (2,2 ) (3,2 ) (4,2 ) (2,n ) 終点 (3,n ) 終点 (4,n ) 終点 縦は一方通行 縦でも横でも 空気=空気-1+10 0 →0 -100 0 -100 →0 状態の変化
5.
ノードの分割 1. ノードの状態が変わる のはめんどくさい 2.
別のノードとして捉える 3. 頂点(x,y,left,right,oxigen)で考える (0,0) (0,0,0,0,1) (1,0) (0,1) (1,1) 普通の捉え方 distance[x][y] = 最小コスト +3 -10 -10 or 0 +3 or 0 -1 + 5 +5 or 0 -1 or 0 (1,0,0,0,10) 初期空気=2 最大空気=5 仮の始点を置く場合もあるが 今回は置かないほうが楽 3 0 (1,0,1,1,5) 5 (1,1,1,1,4) 3 (0,0,0,1,4) 0 (1,0,0,1,3) 1 + + 1(0,1,0,0,0) 空気がないので 行き止まり (1,0,0,1,5) 0 0 (0,0,0,1,4) 1 (0,1,0,0,3) 空気があるので 行き止まらない 仮の終点を置く場合もあるが 空気1以上でy==HEIGHT-1 の 頂点をみたらいい distance[x][y][l][r][o] = 最小コスト
6.
実装方法 • struct Node
{int cost,x,y,left,right,oxigen; (コンストラクタもかく) }; • std::priority_queue<Node> Q; • 始点: REP(x,W) Q.push(Node(コスト[0][x],x,0,x,x,min(最大,初期空気+空気[0][x]-1))) • ノード: Node node = Q.top(); Q.pop(); • 終点: if(node.oxigen>=1 && node.y==HEIGHT-1) return node.cost; • while(!Q.empty())して毎回最小コストのNodeから道を作る
7.
まとめ • 頂点情報を工夫する(ノードやエッジは固定がいい) • 頂点情報の次元と値域=>
配列サイズ • ダイクストラは最小を見つけられる • 負のエッジは怖いけど工夫次第では無くせる場合がある
8.
おわり