Entries from 2016-03-28 to 1 day
Problem - 300B - Codeforces 暴力でやるだけ。実装が下手。 つまらないミスで時間を溶かした。 #include <bits/stdc++.h> using namespace std; const int MAXN = 48 + 2; const int MAXM = MAXN * MAXN / 2; int n, m; vector< int > G[ MAXN ]; struct UnionFind{ int fa</bits/stdc++.h>…
Problem - D - Codeforces Problem in short: Given k arrays of 1 ~ n permutation, find max LCS length Since the final LCS will be in the first array anyways, we can describe the state as dp[ i ] : maximum length of LCS when a[ 0 ][ i ] is th…
Problem - 414B - Codeforces 2D/0D. #include <bits/stdc++.h> using namespace std; const int MAXN = 2000 + 2; const int MAXK = 2000 + 2; const int MOD = 1e9 + 7; int n, k; int dp[ MAXN ][ MAXK ]; // last digit i, length j, possible ways void solve(){ dp[ 1</bits/stdc++.h>…
Problem - 455A - Codeforces First sort and compress the items. Now we will find that if a number x is to be taken, it will only affect that it might be illegal to take x - 1 or x + 1. So it is only possible to transfer to the next state th…
Problem - B - Codeforces Have an extra vector on the dp array for recording the growth of the virus. There will be some kmp failure function like moves being made at the end of the current string, and it is sufficient to describe it with t…