From 1735d32222c461f94acf2272340ca7cf598ede2b Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sat, 8 Oct 2022 11:50:45 +0800 Subject: [PATCH] =?UTF-8?q?3813.=20=E5=A5=87=E6=95=B0=E5=9B=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://hydro.ac/d/bzoj/record/6340f385fac93abeec777db6 --- BZOJ/3813/3813.cpp | 89 +++++++++++++++++++++++++++++++++++++++++++ BZOJ/3813/data/1.in | 3 ++ BZOJ/3813/data/1.out | 3 ++ BZOJ/3813/data/10.in | 3 ++ BZOJ/3813/data/10.out | 3 ++ BZOJ/3813/data/2.in | 3 ++ BZOJ/3813/data/2.out | 3 ++ BZOJ/3813/data/3.in | 3 ++ BZOJ/3813/data/3.out | 3 ++ BZOJ/3813/data/4.in | 3 ++ BZOJ/3813/data/4.out | 3 ++ BZOJ/3813/data/5.in | 3 ++ BZOJ/3813/data/5.out | 3 ++ BZOJ/3813/data/6.in | 3 ++ BZOJ/3813/data/6.out | 3 ++ BZOJ/3813/data/7.in | 3 ++ BZOJ/3813/data/7.out | 3 ++ BZOJ/3813/data/8.in | 3 ++ BZOJ/3813/data/8.out | 3 ++ BZOJ/3813/data/9.in | 3 ++ BZOJ/3813/data/9.out | 3 ++ 21 files changed, 149 insertions(+) create mode 100644 BZOJ/3813/3813.cpp create mode 100644 BZOJ/3813/data/1.in create mode 100644 BZOJ/3813/data/1.out create mode 100644 BZOJ/3813/data/10.in create mode 100644 BZOJ/3813/data/10.out create mode 100644 BZOJ/3813/data/2.in create mode 100644 BZOJ/3813/data/2.out create mode 100644 BZOJ/3813/data/3.in create mode 100644 BZOJ/3813/data/3.out create mode 100644 BZOJ/3813/data/4.in create mode 100644 BZOJ/3813/data/4.out create mode 100644 BZOJ/3813/data/5.in create mode 100644 BZOJ/3813/data/5.out create mode 100644 BZOJ/3813/data/6.in create mode 100644 BZOJ/3813/data/6.out create mode 100644 BZOJ/3813/data/7.in create mode 100644 BZOJ/3813/data/7.out create mode 100644 BZOJ/3813/data/8.in create mode 100644 BZOJ/3813/data/8.out create mode 100644 BZOJ/3813/data/9.in create mode 100644 BZOJ/3813/data/9.out diff --git a/BZOJ/3813/3813.cpp b/BZOJ/3813/3813.cpp new file mode 100644 index 00000000..a53ba0ea --- /dev/null +++ b/BZOJ/3813/3813.cpp @@ -0,0 +1,89 @@ +#include + +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(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(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; +} diff --git a/BZOJ/3813/data/1.in b/BZOJ/3813/data/1.in new file mode 100644 index 00000000..5c357373 --- /dev/null +++ b/BZOJ/3813/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f6e6fa7b57be73f892b7f6d264ef396a46d82a885fc126256e8a4dd9087c719 +size 258681 diff --git a/BZOJ/3813/data/1.out b/BZOJ/3813/data/1.out new file mode 100644 index 00000000..5ec0a93d --- /dev/null +++ b/BZOJ/3813/data/1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3db04a2f290ff8e8f96c03a989b1b008a54a39676716369009de866caf570a1 +size 83860 diff --git a/BZOJ/3813/data/10.in b/BZOJ/3813/data/10.in new file mode 100644 index 00000000..68e36624 --- /dev/null +++ b/BZOJ/3813/data/10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f4fb0ef9ef9a51e32646de13c3e451edc58df7f7d26b451d7603ee720dec9bbc +size 1311349 diff --git a/BZOJ/3813/data/10.out b/BZOJ/3813/data/10.out new file mode 100644 index 00000000..906d4c3a --- /dev/null +++ b/BZOJ/3813/data/10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0c42b89c9e660800cc0f0f6d833bdcd45e195e92d71e5d1866b6f53f5acc4cb +size 570711 diff --git a/BZOJ/3813/data/2.in b/BZOJ/3813/data/2.in new file mode 100644 index 00000000..08604bf2 --- /dev/null +++ b/BZOJ/3813/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5287dafd77dda96325f19ff07c65e4338d4146244f6a45d1253d32b1e500589e +size 855612 diff --git a/BZOJ/3813/data/2.out b/BZOJ/3813/data/2.out new file mode 100644 index 00000000..f99e980d --- /dev/null +++ b/BZOJ/3813/data/2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7673da4f59ea4bddafb3545b8249b926f264d933c639e6a66780c7dc4cb8c13 +size 379436 diff --git a/BZOJ/3813/data/3.in b/BZOJ/3813/data/3.in new file mode 100644 index 00000000..27de89e4 --- /dev/null +++ b/BZOJ/3813/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e20d74a00c817f5c3263ae90f64d3ac8008f46db5f30e1ba1c5e4d8756cb8824 +size 824955 diff --git a/BZOJ/3813/data/3.out b/BZOJ/3813/data/3.out new file mode 100644 index 00000000..0de80fbd --- /dev/null +++ b/BZOJ/3813/data/3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d2cdb48e3120d2a0158f90e4397a17973133bb93f2cd04e40acb35b8d6c387b +size 211975 diff --git a/BZOJ/3813/data/4.in b/BZOJ/3813/data/4.in new file mode 100644 index 00000000..ec6398a6 --- /dev/null +++ b/BZOJ/3813/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c5ff1069aa7b847b3b71f55792b49b21fa4d73455b15ace6a111d231f22f425 +size 711530 diff --git a/BZOJ/3813/data/4.out b/BZOJ/3813/data/4.out new file mode 100644 index 00000000..1de70268 --- /dev/null +++ b/BZOJ/3813/data/4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad5a010d73ddd4f088322265599fa79c0acd517d80d6f4b4bcdc97635d16f178 +size 211136 diff --git a/BZOJ/3813/data/5.in b/BZOJ/3813/data/5.in new file mode 100644 index 00000000..06033f1d --- /dev/null +++ b/BZOJ/3813/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a366c51302c894fb6d9b9fbae2e367756812f9a3440dad527cfe97240e5fb0ac +size 1080236 diff --git a/BZOJ/3813/data/5.out b/BZOJ/3813/data/5.out new file mode 100644 index 00000000..e512dc18 --- /dev/null +++ b/BZOJ/3813/data/5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb131d900177444556475f183c46c8ce68ae375aee759e68e4635566bc709a41 +size 394615 diff --git a/BZOJ/3813/data/6.in b/BZOJ/3813/data/6.in new file mode 100644 index 00000000..567852f7 --- /dev/null +++ b/BZOJ/3813/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7eaa7136dcabb6eccfb2b0ebd2749d4f1f40dac6100e6866ccc4e08ce80ccc55 +size 1171 diff --git a/BZOJ/3813/data/6.out b/BZOJ/3813/data/6.out new file mode 100644 index 00000000..3b2a4ea6 --- /dev/null +++ b/BZOJ/3813/data/6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0646bf69b6210ba8ab6a1454783fcedce6a3d2a930731fdaab861af823cc005d +size 443 diff --git a/BZOJ/3813/data/7.in b/BZOJ/3813/data/7.in new file mode 100644 index 00000000..427dffa9 --- /dev/null +++ b/BZOJ/3813/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19a2076e6351b23f6322a5d93cc20100fecd3dfeac288709fda4c93cd131b4a0 +size 959474 diff --git a/BZOJ/3813/data/7.out b/BZOJ/3813/data/7.out new file mode 100644 index 00000000..6259ed1c --- /dev/null +++ b/BZOJ/3813/data/7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3dbe6bc0a6fe38a58bed7517bd84a7e29e0bbec7d49b66ce4646128cafc601d6 +size 344770 diff --git a/BZOJ/3813/data/8.in b/BZOJ/3813/data/8.in new file mode 100644 index 00000000..bb26368e --- /dev/null +++ b/BZOJ/3813/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0de9e7820c8e27d4885141e3f4d59fae0f5a4979152d3195cb31e587a3e9b8d2 +size 397106 diff --git a/BZOJ/3813/data/8.out b/BZOJ/3813/data/8.out new file mode 100644 index 00000000..2537aac5 --- /dev/null +++ b/BZOJ/3813/data/8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f445c04126da468ec2efe2405470d50aafbb3e48e4188d216b9527598b79939c +size 126674 diff --git a/BZOJ/3813/data/9.in b/BZOJ/3813/data/9.in new file mode 100644 index 00000000..794ff677 --- /dev/null +++ b/BZOJ/3813/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3738f9fc7056a80e09c7ccd2c215ea4861478abc1876fe05800d171ced31dbf5 +size 122483 diff --git a/BZOJ/3813/data/9.out b/BZOJ/3813/data/9.out new file mode 100644 index 00000000..da76d27c --- /dev/null +++ b/BZOJ/3813/data/9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9fdade9e63bbaba220e986125168bfe8814d24748f507c21421ef5e6c8bf5950 +size 41833