EntropyIncreaser

tmpcode

Apr 30th, 2019
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.77 KB | None | 0 0
  1. #include <cassert>
  2. #include <cstdio>
  3. #include <cstring>
  4. #include <cstdlib>
  5. #include <cmath>
  6. #include <ctime>
  7. #include <cctype>
  8.  
  9. #include <algorithm>
  10. #include <tuple>
  11. #include <random>
  12. #include <bitset>
  13. #include <chrono>
  14. #include <queue>
  15. #include <functional>
  16. #include <set>
  17. #include <map>
  18. #include <vector>
  19. #include <iostream>
  20. #include <limits>
  21. #include <numeric>
  22.  
  23. #ifdef LBT
  24.  
  25. #define LOG(FMT...) fprintf(stderr, FMT)
  26.  
  27. #else
  28.  
  29. #define LOG(FMT...)
  30.  
  31. #endif
  32.  
  33. using namespace std;
  34.  
  35. typedef long long ll;
  36. typedef unsigned long long ull;
  37.  
  38. // mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  39.  
  40. const int N = 21, P = 998244353;
  41.  
  42. int n, x, y;
  43. int inv[N + 1], fac[N + 1], ifac[N + 1], pwx[N + 1], pwy[N + 1];
  44. int a[1 << N][N + 1];
  45. int cnt[1 << N];
  46. bool g[N][N];
  47. int as[N];
  48.  
  49. int norm(int x) { return x >= P ? x - P : x; }
  50.  
  51. void exGcd(int a, int b, int& x, int& y) {
  52.   if (!b) {
  53.     x = 1; y = 0;
  54.     return;
  55.   }
  56.   exGcd(b, a % b, y, x);
  57.   y -= a / b * x;
  58. }
  59.  
  60. int ginv(int a) {
  61.   int x, y;
  62.   exGcd(a, P, x, y);
  63.   return norm(x + P);
  64. }
  65.  
  66. void pln(int* a, int* b) {
  67.   static int tmp[N + 1];
  68.   for (int i = 0; i < n; ++i) {
  69.     tmp[i] = a[i + 1] * (i + 1LL) % P;
  70.     for (int j = 1; j <= i; ++j)
  71.       tmp[i] = (tmp[i] + P - tmp[i - j] * (ll)a[j] % P) % P;
  72.   }
  73.   for (int i = n; i; --i)
  74.     b[i] = tmp[i - 1] * (ll)inv[i] % P;
  75.   b[0] = 0;
  76. }
  77.  
  78. // G' = G * f'
  79. void pexp(int* a, int* b) {
  80.   static int tmp[N + 1];
  81.   tmp[0] = 1;
  82.   for (int i = 1; i <= n; ++i) {
  83.     tmp[i] = 0;
  84.     for (int j = 1; j <= i; ++j)
  85.       tmp[i] = (tmp[i] + tmp[i - j] * (ll)a[j] % P * j) % P;
  86.     tmp[i] = tmp[i] * (ll)inv[i] % P;
  87.   }
  88.   memcpy(b, tmp, sizeof(tmp));
  89. }
  90.  
  91. void prepare(int n) {
  92.   inv[1] = 1;
  93.   for (int i = 2; i <= n; ++i)
  94.     inv[i] = -(P / i) * (ll)inv[P % i] % P + P;
  95.   fac[0] = 1;
  96.   for (int i = 1; i <= n; ++i) fac[i] = fac[i - 1] * (ll)i % P;
  97.   ifac[0] = 1;
  98.   for (int i = 1; i <= n; ++i) ifac[i] = ifac[i - 1] * (ll)inv[i] % P;
  99.   pwx[0] = 1;
  100.   for (int i = 1; i <= n; ++i)
  101.     pwx[i] = pwx[i - 1] * (ll)x % P;
  102.   pwy[0] = 1;
  103.   for (int i = 1; i <= n; ++i)
  104.     pwy[i] = pwy[i - 1] * (ll)y % P;
  105.   for (int i = 1; i < 1 << n; ++i)
  106.     cnt[i] = cnt[i >> 1] + (i & 1);
  107. }
  108.  
  109. int main() {
  110. #ifdef LBT
  111.   freopen("test.in", "r", stdin);
  112.   int nol_cl = clock();
  113. #endif
  114.  
  115.  
  116.   scanf("%d", &n);
  117.   for (int i = 0; i < n; ++i) {
  118.     for (int j = 0; j < n; ++j)
  119.       scanf("%d", &g[i][j]);
  120.     for (int j = 0; j < n; ++j)
  121.       as[i] |= g[i][j] << j;
  122.   }
  123.   scanf("%d%d", &x, &y);
  124.   prepare(n);
  125.   for (int s = 0; s < 1 << n; ++s) {
  126.     int cn = 0;
  127.     for (int i = 0; i < n; ++i) {
  128.      
  129.     }
  130.   }
  131.  
  132. #ifdef LBT
  133.   LOG("Time: %dms\n", int ((clock()
  134.           -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
  135. #endif
  136.   return 0;
  137. }
Advertisement
Add Comment
Please, Sign In to add comment