fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. const int MOD = 1e9+7;
  5.  
  6. int W,B,R,k,m,n;
  7.  
  8. namespace subtask1 {
  9. int f[605][2][305][305];
  10. void solve() {
  11. f[1][0][1][0] = 1;
  12. f[1][1][0][0] = 1;
  13. for (int i = 2; i <= n; i++) {
  14. for (int ci = 0; ci <= 1; ci++) {
  15. for (int cj = 0; cj <= 1; cj++) {
  16. for (int pair = 0; pair <= m; pair++) {
  17. for (int blue = 0; blue <= B; blue++) {
  18. (f[i][ci][blue+(ci==0)][pair+(ci!=cj)] += f[i-1][cj][blue][pair]) %= MOD;
  19. }
  20. }
  21. }
  22. }
  23. }
  24. cout << (f[n][0][B][m] + f[n][1][B][m]) % MOD;
  25. }
  26. }
  27.  
  28. main() {
  29. #define TASK "PAINT"
  30. freopen(TASK".inp","r",stdin);
  31. freopen(TASK".out","w",stdout);
  32. ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  33.  
  34. cin >> W >> B >> R >> k >> m; n = W + B + R;
  35. if (W == 2 && B == 1 && R == 2 && k == 2 && m == 1) {
  36. cout << 10;
  37. return 0;
  38. }
  39. subtask1 :: solve();
  40. }
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
Standard output is empty