Competition link: Click to open the link
I first started f and c, and then found that the status was wrong. In the afternoon, the brain holes were wide open ,,
Brainless wa, brainless ce... The same mistake is committed twice ..
I had a few shots at my head, and I got a G code in the last 20 minutes. I don't know why I can't use 1 as a station that can't be refueled .. Too weak ..
Well, I'm too lazy to answer questions the next day ..
B: Gears
Query set
Question: Click the open link.
C: Consecutive Blocks
Discretization and then simulate
Question: Click the open link.
D: An Easy Game
Set dp [I] [j] to the number of methods where the first I position matches the j position.
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include #include
using namespace std;#define ll long long#define mod 1000000009#define N 105int n, K, m;int dp[N][N];int C[N][N];string s1;string s2;int dfs(int differ, int left) { if (left == 0) { return differ == 0; } else { if (~dp[differ][left]) { return dp[differ][left]; } int &ans = dp[differ][left]; ans = 0; int a = differ; int b = n - differ; for (int i = 0; i <= differ && i <= m; ++i) { if (b >= m - i) { ans += (int)((ll)C[b][m - i] * C[a][i] % mod * dfs(differ - i + (m - i), left - 1) % mod); ans %= mod; } } return ans; }}int main(){ for (int i = 0; i < N; ++i) { C[i][i] = 1; for (int j = 0; j < i; ++j) { C[i][j] = C[i - 1][j - 1] + C[i - 1][j]; C[i][j] %= mod; } } while (cin >> n >> K >> m){ cin >> s1 >> s2; int nSum = 0; int nLen = s1.length(); for (int i = 0; i < nLen; ++i) { if (s1[i] != s2[i]) { ++nSum; } } memset(dp, -1, sizeof(dp)); int ans = dfs(nSum, K); printf("%d\n", ans); } return 0;}
E: Romantic Value
Simple minimal cut.
Question: Click the open link.
F: First Digit
Silk question ..
#include
#include
#include
#include #include
#include
#include
#include
#include
#include
#include
#include
using namespace std;int main(){ int T ,m,u,v,w; scanf("%d",&T); while(T--){ scanf("%d%d",&u,&v);puts("1"); } return 0;}
G: Greedy Driver
Spfa2 times ,,
Question: Click the open link.
H: Grouping
Finding the longest chain in the point-down topological order
Question: Click the open link.