2011-03-17から1日間の記事一覧

SRM411 div2 hard

最大でも200*200程度の大きさでしかないので 座標を全てメモリにとってシュミレーション。 #include <vector> #include <queue> #define OFFSET 100 using namespace std; class HoleCakeCuts { public: int cake[201][201]; int cutTheCake(int cakeLength, int holeLength</queue></vector>…

SRM309 div2 hard

候補になりそうな所を全部試したら通った #include <algorithm> #include <climits> #include <sstream> #include <string> #include <vector> typedef long long LL; using namespace std; LL ABS(LL n) { return (0<=n) ? n : -n; } class SynchronizingGuideposts { public: LL minCost(vector<string> _guidepo</string></vector></string></sstream></climits></algorithm>…

SRM434 div2 hard

多倍長計算が必要、最初はdoubleでやろうとしたけど通らなかったので(解説見たので)多倍長に切り替えた。5時間ぐらいかかったんちゃうかな。 #include <string> #include <functional> #include <algorithm> #include <vector> using namespace std; int c2i(char c) { return (c<='9') ? c-'0' :</vector></algorithm></functional></string>…

SRM326 div2 hard

水面の高さを1ずつ上げていってBFSすると簡単に書けた #include <queue> #include <vector> #include <string> using namespace std; class PoolFiller { public: int BFS(vector<string> pool) { int h=pool.size(),w=pool[0].size(); int r=0; int mv[4][2]={{0,-1},{0,1},{-1,0},{1,0}};</string></string></vector></queue>…