Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimize("Ofast")
- #pragma GCC target("avx,avx2,fma,popcnt")
- #include <bits/stdc++.h>
- #define F first
- #define S second
- #define vec vector
- #define pb push_back
- #define cld complex<ld>
- #define pll pair<ll, ll>
- #define pdd pair<ld, ld>
- #define umap unordered_map
- #define uset unordered_set
- #define pii pair<int, int>
- #define pnn pair<Node*, Node*>
- #define all(m) m.begin(), m.end()
- #define uid uniform_int_distribution
- #define init(m, x) memset(m, x, sizeof(m));
- #define pripii(p) cout << "{" << p.F << ", " << p.S << "} "
- #define fast cin.tie(0); cout.tie(0); cin.sync_with_stdio(0); cout.sync_with_stdio(0);
- using namespace std;
- typedef string str;
- typedef long long ll;
- typedef long double ld;
- typedef unsigned int uint;
- typedef unsigned long long ull;
- mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
- #include<immintrin.h>
- const int a = 5000, U = a / 256 + 1;
- uint A[a][256], B[a][256];
- int main() {
- fast;
- uid<uint> g1(0, UINT32_MAX);
- for (int q = 0; q < a; q++) {
- for (int w = 0; w < a / 32 + 1; w++) {
- A[q][w] = g1(rnd);
- }
- }
- for (int q = 0; q < a; q++) {
- for (int w = 0; w < a / 32 + 1; w++) {
- B[q][w] = g1(rnd);
- }
- }
- __m256i xA[a][U], xB[a][U];
- for (int q = 0; q < a; q++) {
- for (int w = 0; w < U; w++) {
- xA[q][w] = _mm256_load_si256(reinterpret_cast<const __m256i_u *>(&A[q][w * 8]));
- xB[q][w] = _mm256_load_si256(reinterpret_cast<const __m256i_u *>(&B[q][w * 8]));
- }
- }
- uint ans[a][a / 32 + 1]; init(ans, 0);
- for (int q = 0; q < a; q++) {
- for (int w = 0; w < a; w++) {
- uint tyt = 0;
- __m256i res = _mm256_set_epi64x(0, 0, 0, 0);
- for (int e = 0; e < U; e++) {
- res = _mm256_xor_si256(res, _mm256_and_si256(xA[q][e], xB[w][e]));
- }
- for (int e = 0; e < 4; e++) {
- tyt ^= __builtin_parityll(res[e]);
- }
- ans[q][w >> 5] |= tyt << (w & 31);
- }
- }
- for (int q = 0; q < a; q++) {
- for (int w = 0; w < a / 32 + 1; w++) {
- cout << ans[q][w] << " ";
- }
- cout << "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement