SlideShare une entreprise Scribd logo
1  sur  15
Télécharger pour lire hors ligne
原案:井上・青木
解答:井上・青木
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
1
 二次元格子のマス上でのダウジング情報
が与えられる
 財宝があるマスに到達できるか調べよ
 Yes: 到達可能
 No: 到達不可能
 Unknown: 不明
 Broken: 矛盾
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
2
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
3
2rs+1
2rs+1+1
1 <= s <= d-1 のとき s = 0 のとき 2r1+1
s = d のとき
2rd+1
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
4
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
5
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
6
 4つの例
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
7
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
8
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
9
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
10
No
 財宝がないマスを全て取り除き、残った
マスが財宝がある場所の候補
 到達可能な財宝マスの数と到達不可能な
財宝マスの数で4通に場合分け
 到達判定はDFSやBFS
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
11
u[i][j] = { true, true, ..., true };
for (int k=0; k<n; k++) {
cin >> x >> y >> s;
for (int i=0; i<h; i++) for (int j=0; j<w; j++) {
if (s > 0) { // s-1の内側に財宝がない
lx = x-r[s-1]; rx = x+r[s-1];
by = y-r[s-1]; ty = y+r[s-1];
if (lx <= j && j <= rx && by <= i && i <= ty)
u[i][j] = false;
}
if (s < d) { // sの外側に財宝がない
lx = x-r[s]; rx = x+r[s];
by = y-r[s]; ty = y+r[s];
if (!(lx <= j && j <= rx && dy <= i && i <= uy))
u[i][j] = false;
}
}
}
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
12
財宝がないマスを全て取り除き、残ったマスが財宝がある場所の候補
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
13
reachable = noroute = false;
for (int i=0; i<h; i++) for (int j=0; j<w; j++)
if (u[i][j])
if (bfs(j, i)) // マス(j, i)からDの位置までの経路があるか
reachable = true;
else
noroute = true;
if (reachable && noroute) // 一部に到達可能で、一部に到達不可能
cout << “Unknown” << endl;
if (reachable && !noroute) // 全てに到達可能
cout << “Yes” << endl;
if (!reachable && noroute) // 全てに到達不可能
cout << “No” << endl;
if (!reachable && !noroute)// 財宝マスの候補がない
cout << “Broken” << endl;
到達可能な財宝マスの数と到達不可能な財宝マスの数で場合分け
 井上1 (C++)
 84行
 井上2 (C++)
 101行
 青木 (Java)
 86行
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
14
 Accept / Submit
 12 / 52 (23.08%)
 First Accept
 Online: takapt0226さん (48分)
 Onsite: チーム yz (56分)
2014/3/19
立命館大学プログラミングコンテスト
合宿 Day3
15

Contenu connexe

En vedette

Revisiting floorplan representation
Revisiting floorplan representationRevisiting floorplan representation
Revisiting floorplan representationYuma Inoue
 
2年生向けICPC紹介資料
2年生向けICPC紹介資料2年生向けICPC紹介資料
2年生向けICPC紹介資料Yuma Inoue
 
Graph Clustering on Missing Data
Graph Clustering on Missing DataGraph Clustering on Missing Data
Graph Clustering on Missing DataYuma 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
 

En vedette (9)

Arc 010 d
Arc 010 dArc 010 d
Arc 010 d
 
Revisiting floorplan representation
Revisiting floorplan representationRevisiting floorplan representation
Revisiting floorplan representation
 
2年生向けICPC紹介資料
2年生向けICPC紹介資料2年生向けICPC紹介資料
2年生向けICPC紹介資料
 
Graph Clustering on Missing Data
Graph Clustering on Missing DataGraph Clustering on Missing Data
Graph Clustering on Missing Data
 
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_C