SlideShare a Scribd company logo
1 of 9
Download to read offline
2014/03/19立命館大学競技プログラミング合宿
D: Disciple Life Is Hard!
- 弟子はつらいよ -
原案:井上!
解答:青木・井上
"1
2014/03/19立命館大学競技プログラミング合宿
問題概要
毎日トレーニングを行い、消費したカロリーの分だ
けドーナツを食べ、幸福を得る!
日々の幸福の総和を最大化せよ。ただし、!
トレーニングはU種類ちょうど行う!
その日残っている体力で可能なトレーニングしか
できない!
ドーナツは同じものを何度たべてもよい
"2
2014/03/19立命館大学競技プログラミング合宿
想定解法: DP祭り
DP(動的計画法)を3種類行うことで答えを求める!
DP1: 体力→消費カロリー!
DP2: 消費カロリー→幸福度!
DP3: 体力→幸福度!
DP3でDP1とDP2の結果を利用する
"3
2014/03/19立命館大学競技プログラミング合宿
想定解法: DP1
DP1: 体力→消費カロリー!
DP1[i][j][k] := i番目までのトレーニングをj種類行い、

体力をk消費したときの最大消費カロリー!
DP1[i][j][k] := max{ DP1[i-1][j-1][k-ei] + ci}!
ある体力xのときの最大の消費カロリーがDP1[T][U][x]
で求められる!
O(TUS)
"4
2014/03/19立命館大学競技プログラミング合宿
想定解法: DP2
DP2: 消費カロリー→幸福度!
DP2[i][j] := i番目までのドーナツでカロリーを

jだけ摂取するときの最大の幸福度!
個数制限なしナップサックDP!
DP2[i][j] := max{ DP2[i-1][j], DP2[i][j-ai] + hi}!
O(N・sum{ci})
"5
2014/03/19立命館大学競技プログラミング合宿
想定解法: DP3
DP3: 体力→幸福度!
DP3[i][j] := i日目に体力jを残して得られる最大の幸福度!
DP3[i][j] := 

max{ DP3[i-1][j-x-O] + DP2[N][DP1[T][U][x]]}!
ただし、j-x≧Oとなるxのみ調べる!
O(DS2
)
"6
2014/03/19立命館大学競技プログラミング合宿
writer解
井上(C++) 56行!
青木(Java) 96行
2014/03/19立命館大学競技プログラミング合宿
提出状況
First Acceptance!
on-site: urbanhotel (01:07)!
on-line: sky58 (00:27)!
正答率 13/26 (50.0%)
2014/03/19立命館大学競技プログラミング合宿
余談
皆さん、お気付きだろうか
D O N T U S!
=!
ドーナツ

More Related Content

Viewers also liked

Revisiting floorplan representation
Revisiting floorplan representationRevisiting floorplan representation
Revisiting floorplan representationYuma Inoue
 
Graph Clustering on Missing Data
Graph Clustering on Missing DataGraph Clustering on Missing Data
Graph Clustering on Missing DataYuma Inoue
 
2年生向けICPC紹介資料
2年生向けICPC紹介資料2年生向けICPC紹介資料
2年生向けICPC紹介資料Yuma Inoue
 
Thesis Defence for Doctor of Information Science
Thesis Defence for Doctor of Information ScienceThesis Defence for Doctor of Information Science
Thesis Defence for Doctor of Information ScienceYuma Inoue
 
LCA and RMQ ~簡潔もあるよ!~
LCA and RMQ ~簡潔もあるよ!~LCA and RMQ ~簡潔もあるよ!~
LCA and RMQ ~簡潔もあるよ!~Yuma Inoue
 
博士論文執筆の流れ
博士論文執筆の流れ博士論文執筆の流れ
博士論文執筆の流れYuma Inoue
 

Viewers also liked (9)

Arc 010 d
Arc 010 dArc 010 d
Arc 010 d
 
Revisiting floorplan representation
Revisiting floorplan representationRevisiting floorplan representation
Revisiting floorplan representation
 
Graph Clustering on Missing Data
Graph Clustering on Missing DataGraph Clustering on Missing Data
Graph Clustering on Missing Data
 
2年生向けICPC紹介資料
2年生向けICPC紹介資料2年生向けICPC紹介資料
2年生向けICPC紹介資料
 
Planar graph
Planar graphPlanar graph
Planar graph
 
LP Duality
LP DualityLP Duality
LP Duality
 
Thesis Defence for Doctor of Information Science
Thesis Defence for Doctor of Information ScienceThesis Defence for Doctor of Information Science
Thesis Defence for Doctor of Information Science
 
LCA and RMQ ~簡潔もあるよ!~
LCA and RMQ ~簡潔もあるよ!~LCA and RMQ ~簡潔もあるよ!~
LCA and RMQ ~簡潔もあるよ!~
 
博士論文執筆の流れ
博士論文執筆の流れ博士論文執筆の流れ
博士論文執筆の流れ
 

RUPC2014_Day3_D