0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-08 12:58:48 +00:00

3813. 奇数国

https://hydro.ac/d/bzoj/record/6340f385fac93abeec777db6
This commit is contained in:
Baoshuo Ren 2022-10-08 11:50:45 +08:00
parent 73b55d8552
commit 1735d32222
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
21 changed files with 149 additions and 0 deletions

89
BZOJ/3813/3813.cpp Normal file
View File

@ -0,0 +1,89 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 1e5 + 5;
const int mod = 19961993;
const int primes[]{0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281};
int n, a[N], c[61][N], p[61][N];
int lowbit(int x) {
return x & -x;
}
void add(int* c, int x, int y) {
for (; x <= 100000; x += lowbit(x)) c[x] += y;
}
int sum(int* c, int x) {
int res = 0;
for (; x; x -= lowbit(x)) res += c[x];
return res;
}
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i = 1; i <= 100000; i++) {
a[i] = 3;
add(c[2], i, 1);
}
for (int i = 1; i <= 60; i++) {
p[i][0] = 1;
for (int j = 1; j <= 100000; j++) {
p[i][j] = static_cast<long long>(p[i][j - 1]) * (j > 1 ? primes[i] : (primes[i] - 1)) % mod;
}
}
for (int i = 1, op, x, y; i <= n; i++) {
cin >> op >> x >> y;
if (op == 0) {
int ans = 1;
for (int j = 1; j <= 60; j++) {
ans = static_cast<long long>(ans) * p[j][sum(c[j], y) - sum(c[j], x - 1)] % mod;
}
cout << ans << endl;
} else { // op == 1
for (int i = 1; i <= 60; i++) {
if (a[x] % primes[i] == 0) {
int cnt = 0, t = a[x];
while (t % primes[i] == 0) {
t /= primes[i];
cnt++;
}
add(c[i], x, -cnt);
}
}
a[x] = y;
for (int i = 1; i <= 60; i++) {
if (a[x] % primes[i] == 0) {
int cnt = 0, t = a[x];
while (t % primes[i] == 0) {
t /= primes[i];
cnt++;
}
add(c[i], x, cnt);
}
}
}
}
return 0;
}

BIN
BZOJ/3813/data/1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3813/data/9.out (Stored with Git LFS) Normal file

Binary file not shown.