2012-12-26から1日間の記事一覧

AOJ 0121 - Seven Puzzle

aoj

ほんとうにきたないのでかきたくない.

AOJ 0180 - Stellar Performance of the Debunkey Family(Kruskal法)

aoj

コードがながい.unique_ptrがつかってみたかったのだけど,使い所間違っているかなー. kruskal法はむずかしいと思っていましたが,そうでもなかったです. #include<iostream> #include<memory> #include<vector> #include<algorithm> class UnionFind{ private: int n; std::unique_ptr<int[]> par, ra</int[]></algorithm></vector></memory></iostream>…

AOJ 0180 - Stellar Performance of the Debunkey Family(Prim法)

aoj

タイトルがながい #include<iostream> #include<algorithm> const int MAX_N = 100, MAX_M = 100, INF = 1 << 24; int n, m; int cost[MAX_N][MAX_N], mincost[MAX_N], used[MAX_N]; int prim(){ std::fill(mincost, mincost+MAX_N, INF); std::fill(used, used+MAX_N, 0); mincos</algorithm></iostream>…