fork download
  1. const int N = 1e5 + 5;
  2. const int M = 313;
  3. const int P = 1e9 + 7;
  4. int D[N][M];
  5. const int K = 303;
  6. int split[K][K];
  7. int fac[N];
  8. int spow(int a, int b) {
  9. int r = 1;
  10. while (b) {
  11. if (b % 2) {
  12. r = r * a % P;
  13. }
  14. a = a * a % P;
  15. b /= 2;
  16. }
  17. return r;
  18. }
  19. int Inv(int a) {
  20. return spow(max(a, 1ll), P - 2);
  21. }
  22. int inv[N];
  23. void Init() {
  24. D[0][0] = 1;
  25. fac[0] = 1;
  26. inv[0] = 1;
  27. RE (n, N - 1) {
  28. inv[n] = Inv(n);
  29. D[n][0] = 1;
  30. fac[n] = n * fac[n - 1] % P;
  31. }
  32. RE (m, M - 1) {
  33. int sum = (m == 1);
  34. RE (n, N - 1) {
  35. D[n][m] = sum * inv[n] % P;
  36. sum = (sum + D[n][m - 1] + D[n][m]) % P;
  37. }
  38. }
  39.  
  40. split[0][0] = 1;
  41. RE (got, K - 1) {
  42. RE (nonzero, K - 1) {
  43. split[got][nonzero] = (split[got - 1][nonzero] + split[got - 1][nonzero - 1]) * nonzero % P;
  44. }
  45. }
  46. }
  47.  
  48. class CyclesNumber {
  49.  
  50. public:
  51. #undef int
  52. vector <int> getExpectation(vector <int> n, vector <int> m) {
  53. vector<int> res;
  54. #define int long long
  55. Init();
  56.  
  57. for (int i = 0; i < SZ(n); i++) {
  58. int sum = 0;
  59. debug(m[i]);
  60. FOR (j, 0, m[i]) {
  61. sum += split[m[i]][j] * D[n[i]][j] % P * fac[n[i]] % P;
  62. }
  63. res.PB(sum % P);
  64. }
  65. return res;
  66.  
  67. }
  68.  
  69. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int Inv(int)':
prog.cpp:20:25: error: 'max' was not declared in this scope
   return spow(max(a, 1ll), P - 2);
                         ^
prog.cpp: In function 'void Init()':
prog.cpp:27:7: error: 'n' was not declared in this scope
   RE (n, N - 1) {
       ^
prog.cpp:27:15: error: 'RE' was not declared in this scope
   RE (n, N - 1) {
               ^
prog.cpp:32:7: error: 'm' was not declared in this scope
   RE (m, M - 1) {
       ^
prog.cpp:41:7: error: 'got' was not declared in this scope
   RE (got, K - 1) {
       ^
prog.cpp: At global scope:
prog.cpp:52:3: error: 'vector' does not name a type
   vector <int> getExpectation(vector <int> n, vector <int> m) {
   ^
stdout
Standard output is empty