2012-05-11から1日間の記事一覧

POJ3186 Treat for the Cows

最初「辞書順最小の文字列をとってくればいいんじゃないか」とか勘違いして、嘘解法する。当然落とされる。 よく考えると、区間についてのDPができる。このタイプのDPはじめてだったので新鮮だった。良問だと思う。 #include<stdio.h> #include<algorithm> #include<vector> #include<deque> usi</deque></vector></algorithm></stdio.h>…

POJ3256 Cow Picnic

強連結成分分解使わなくても適当に探索したら通りそうだけど、強連結成分分解の練習のために縛りプレイを敢行。 バグ取り時間かかった。 #include<stdio.h> #include<algorithm> #include<vector> #include<stack> #include<queue> using namespace std; typedef pair<int,int> pii; vector<int>map[1000]; vector<int>rmp[</int></int></int,int></queue></stack></vector></algorithm></stdio.h>…

POJ3171 Cleaning Shifts

普通にDPと思いきやうまくDPできない(N^2になる) とりあえずsegtree使ってDPしてN log Nにおとす。通る。 はじめてのsegtreeなのっ! #include<stdio.h> #include<algorithm> #include<vector> using namespace std; #define mt(A,B,C) make_pair(make_pair(A,B),C) typedef long long ll</vector></algorithm></stdio.h>…