2010-06-05から1日間の記事一覧

PKU 3328 Cliff Climbing

ダイクストラ法 [x座標][y座標][右足/左足]でコストを持たせる [左足x座標][左足y座標][右足x座標][右足y座標]だとTLEだった const int dx[] = {1, 1, 1, 1, 1, 2, 2, 2, 3}; const int dy[] = {2, 1, 0, -1, -2, 1, 0, -1, 0}; static int dp[32][64][2]; s…

PKU 3327 Cut the Cake

やるだけ ケーキに番号を振るやり方を間違えてREを連発してしまった struct Piece { int x, y; Piece() { } Piece(int x, int y) : x(x), y(y) { } }; int main() { for (int n, w, d; cin >> n >> w >> d && (n || w || d); ) { vector<Piece> ps; ps.push_back(Pi</piece>…

PKU 3326 Analyzing Login/Logout Records

やるだけ 時間の分だけ配列を取って塗りつぶしていく方法と、数直線状で扱う方法がある この解答は後者 int main() { for (int N, M; cin >> N >> M && (N || M); ) { int r; cin >> r; vector<vector<pair<int, int> > > loginout(M + 1); REP(i, r) { int t, n, m, s; cin >> t ></vector<pair<int,>…