mayoko’s diary

プロコンとかいろいろ。

2015-03-24から1日間の記事一覧

SRM647div2hard:BuildingTowers

こっちはやや手間取った。問題:http://community.topcoder.com/stat?c=problem_statement&pm=13606解法:easy問題のようにすべての頂点について高さを2分探索することはできない。しかし、よく考えると、高さが最大の点は、高さ制約がある点の間で山を作れば…

SRM647div1easy:BuildingTowersEasy

これは簡単なのでコードだけ。問題:http://community.topcoder.com/stat?c=problem_statement&pm=13634&rd=16279 const int INF = 1e9; bool ok(int pos, int h, const vector<int>& x, const vector<int>& t) { if (h > pos-1) return false; int n = x.size(); for (</int></int>…

SRM648div1med:KitayutaMart

問題:http://community.topcoder.com/stat?c=problem_statement&pm=13649&rd=16312解法:まず基本として、値段が小さいものから順に買っていくのが最適である。ということで、値段の小さい順に選んでいった時、N番目のものは何かを求めれば良い。 KやNはかな…