Advertisement
am1x

xorcubes001.cpp

Feb 11th, 2023
714
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | Fixit | 0 0
  1. #include <stdio.h>
  2. #include <inttypes.h>
  3. #include <assert.h>
  4.  
  5. typedef uint32_t uint_t;
  6. const uint32_t N = 1 << 11, P = 998244353;
  7.  
  8. static uint32_t cubes[N];
  9.  
  10. int main()
  11. {
  12.     for (uint64_t i = 0; i < N; i++) {
  13.         cubes[i] = (i * i % P) * i % P;
  14.     }
  15.  
  16.     uint32_t n = 0;
  17.     int st = scanf("%u", &n);
  18.     assert (st == 1);
  19.     assert (n < N);
  20.     n++;
  21.  
  22.     uint64_t res = 0;
  23.     for (uint32_t i = 0; i < n; i++) {
  24.         for (uint32_t j = 0; j < i; j++) {
  25.             uint64_t rk = 0;
  26.             for (uint32_t k = 0; k < j; k++) {
  27.                 rk +=  cubes[i ^ k] * (uint64_t) cubes[j ^ k];
  28.                 if (k % 16 == 15)
  29.                     rk %= P;
  30.             }
  31.             res = (res + rk % P * cubes[i ^ j]) % P;
  32.         }
  33.     }
  34.     res = res * 6 % P;
  35.     printf("%u\n", (uint32_t) res);
  36.  
  37. }
  38.  
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement