Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit21d1de5

Browse files
committed
use four russians in prod_mod_2
1 parenta62370b commit21d1de5

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

‎cp-algo/structures/bitpack.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
21
#ifndef CP_ALGO_STRUCTURES_BITPACK_HPP
32
#defineCP_ALGO_STRUCTURES_BITPACK_HPP
4-
#include"bit_array.hpp"
3+
#include"../structures/bit_array.hpp"
54
#include<cstdint>
65
#include<cstddef>
76
#include<string>

‎verify/structures/bitpack/prod_mod_2.test.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// @brief Matrix Product (Mod 2)
33
#definePROBLEM"https://judge.yosupo.jp/problem/matrix_product_mod_2"
44
#pragma GCC optimize("Ofast,unroll-loops")
5-
#pragma GCC target("tune=native")
65
#include"cp-algo/structures/bitpack.hpp"
76
#include<bits/stdc++.h>
87

@@ -11,6 +10,19 @@ using cp_algo::structures::bitpack;
1110

1211
constint maxn =1 <<12;
1312
bitpack<maxn> a[maxn], b[maxn], c[maxn];
13+
constint K =8;
14+
bitpack<maxn> precalc[maxn / K][1 << K];
15+
16+
voidprocess_precalc() {
17+
for(int i =0; i < maxn / K; i++) {
18+
for(int j =0; j < K; j++) {
19+
int step =1 << j;
20+
for(int k =0; k < step; k++) {
21+
precalc[i][k + step] = precalc[i][k] ^ b[K * i + j];
22+
}
23+
}
24+
}
25+
}
1426

1527
voidsolve() {
1628
int n, m, k;
@@ -24,10 +36,11 @@ void solve() {
2436
cin >> row;
2537
b[i] = row;
2638
}
27-
for(int i =0; i < n; i++) {
28-
for(int j =0; j < m; j++) {
29-
if(a[i][j]) {
30-
c[i] ^= b[j];
39+
process_precalc();
40+
for(int j =0; j < m; j +=64) {
41+
for(int z =0; z <64 / K; z++) {
42+
for(int i =0; i < n; i++) {
43+
c[i] ^= precalc[j / K + z][uint8_t(a[i].word(j /64) >> K * z)];
3144
}
3245
}
3346
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp