2012-02-13から1日間の記事一覧

JOI2012本選5番

ダイクストラして最大全域木求めてLCAする全部入り問題。 #include <vector> #include <queue> #include <stdio.h> #include <algorithm> #include <string.h> #include <queue> #define MAX_V 100000+10 #define MAX_Q 100000+10 #define INF (1<<28) #define ROOT 1 using namespace std; struct Edge{ int to,c</queue></string.h></algorithm></stdio.h></queue></vector>…

JOI2012本選4番

講義資料 - いもす研 (imos laboratory) ↑参照。 累積和を使ったコード #include <stdio.h> int nails[5010][5010]; int main(){ int n,m; scanf("%d%d",&n,&m); for(int i=0;i</stdio.h>

JOI2012本選3番

時間がSにかぶるときだけ気をつけてdpすればOK。 #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; int n,S,T; int A[3010],B[3010]; int dp[3010][3010]; int rec(int store,int time){ if(store==n) return 0; else if(dp[store][time]!=-1) return dp</algorithm></string.h></stdio.h>…

JOI2012本選2番

dp[ap=Aの何枚目か][bp=Bの何枚目か]でDPした。 #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; int dp[5010][5010]; int ac[5010],bc[5010]; int rec(int ap,int bp){ if(ap<0||bp<0) return 0; else if(dp[ap][bp]!=-1) return dp[ap][bp]; else{ in</algorithm></string.h></stdio.h>…

JOI2012本選1番

解説を聞いてから自分のやっていたことがRunLength圧縮と同じであると気づいた。 #include <stdio.h> #include <vector> using namespace std; char in[10000000+10]; int main(){ scanf("%s",in); vector<int> ch,sq; int c=in[0],s=1; for(int i=1;in[i]!=0&&in[i]!='\n';i++){ i</int></vector></stdio.h>…

JOI2012本選まとめ

↑の大会に参加してきました。 実力を限界まで発揮できたと思います。 合宿は問題を楽しむだけにしようと思います。