2013-01-17から1日間の記事一覧

SRM 272 DIV1 Hard ManhattanDistance

問題 Editorial 問題 画像が上手く表現できないので略 解答 (交差点の(x * y * (真ん中, 四隅)))でDPするだけ。 (width コメント これは一瞬で解けるべき コード #include <string> #include <algorithm> #include <cstring> #include <complex> #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i</complex></cstring></algorithm></string>…

SRM 270 DIV1 Hard PackingShapes

問題 Editorial 問題 (問題の肝の部分のみ) width*heightの長方形の中にx*yの長方形が回転してでも入るかどうかを判定せよ 全ての数値は整数, [1,1000] 解答 回転後の幅と高さは(x cosθ + y sinθ, x sinθ + y cosθ)。 それを適当にいろんな感じで二分探索し…