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

SRM300 div2 hard

列車を動かしても本質的な(円にそって回すと)順番は変わらないので 貪欲に動かせる列車の中で一番番号の若いものから動かす ちなみにこれがdiv2hard50問め、あと50問 #include <string> using namespace std; class CircleOrder { public: string firstOrder(s</string>…

SRM315 div2 hard

1時間分からなかったので解説見てしまった。 悔しいけどエジソンが言ってる言葉もあるし次頑張る。 ソースコードは解説の丸パクなのでそっちを見てください。 TopCoder Statistics シュミレーションを早めに見切れば思いついたかもなあ・・・

SRM439 div2 hard

swapは一番最初にすれば全部試してしまえば良いというのに気づけば一発 一回の操作ごとに前1つか、後ろ1か、前後ろ1つずつ考えなくても良くなる #include <cstring> #include <string> using namespace std; class PalindromeFactory { public: string source[50][50]; int c</string></cstring>…

SRM425 div2 hard

全探索なんだけど、しんどすぎる。 #include <algorithm> #include <string> #include <vector> #include <cmath> #include <set> using namespace std; class PiecesMover { public: int n; vector<int> pos; int DFS(set<int> se,vector<int> p) { //printf("p.size()=%d\n",p.size()); int r=(1<<28); if(p.size(</int></int></int></set></cmath></vector></string></algorithm>…