1 2 3 4 5 ··· 13 下一页
摘要: 考虑什么时候会改变答案的奇偶,显然可以根据\(x \oplus y\)的奇偶性分组,在组内进行跳跃不会改变,只有当组间跳跃的时候才会改变。 打表观察先手什么时候必胜,其中:\(u\)是当前获胜目标为奇/偶(1/0),\(v\)是位于哪一组,\(a,b\)代表两组还剩多少,\(st\)代表当前答案的奇 阅读全文
posted @ 2023-12-01 19:16 xhy666 阅读(86) 评论(0) 推荐(1)
摘要: CF1900D ​ 从小到大排列,第\(i\)个元素作为最大值对答案的贡献为\(\sum_{x=1}^{i-1} \sum_{y=x+1}^{i-1} gcd(a_x,a_y)\),即区间\([1,i-1]\)两两元素\(gcd\)和,记作\(val_{i-1}\)。然后考虑用第\(i\)个元素更新 阅读全文
posted @ 2023-11-28 00:41 xhy666 阅读(77) 评论(0) 推荐(0)
摘要: 记录回文自动机的一些应用实例 ​ 题目主要来源 模板 ​ 跑\(PAM\)就是构建两棵字典树,字典树上(奇偶)根到不同节点都对应了一个原串中本质不同的回文串,同时维护了每个回文串对应的最长回文后缀。 ​ 这个模板定义节点\(0\)为偶根,节点\(1\)为奇根(有些板子可能反过来) \(next[i] 阅读全文
posted @ 2023-10-31 20:13 xhy666 阅读(108) 评论(0) 推荐(0)
摘要: 一开始感觉完全不可做,因为记忆中线性基求出来以后,只能知道异或和为0的子集数量。然后去补了线性基有关的知识,最后1h知道怎么做了。 ##题意: ![](https://img2023.cnblogs.com/blog/2792543/202308/2792543-20230810230254529- 阅读全文
posted @ 2023-08-11 00:21 xhy666 阅读(140) 评论(0) 推荐(0)
摘要: # Codeforces Round 875 (Div. 2) A~D ### A. Twin Permutations 构造$a[i]+b[i]=n+1$ ```c++ void work() { int n; cin >> n; rep (i, 1, n) { int x; cin >> x; 阅读全文
posted @ 2023-05-29 09:34 xhy666 阅读(251) 评论(0) 推荐(0)
摘要: ## Codeforces Round 873 (Div. 2) A~D2 ### A. Divisible Array 因为$1$一定整除,构造$a_i=i$,再让$a_1$加上和模$n$的余数 ```c++ void work() { int n; cin >> n; vector a(n + 阅读全文
posted @ 2023-05-21 17:14 xhy666 阅读(50) 评论(0) 推荐(0)
摘要: ## Educational Codeforces Round 148 (Rated for Div. 2) A~E ### A. New Palindrome 对于奇回文串不能统计中心的字符,然后判断是否有不同的字符 ```c++ void work() { string s; cin >> s; 阅读全文
posted @ 2023-05-21 17:13 xhy666 阅读(85) 评论(2) 推荐(0)
摘要: [ABC295 F](https://atcoder.jp/contests/abc295/tasks/abc295_f) 题意:十进制下,给定两个正整数$L、 R$和一个字符串$S$,设$F(x)$为$S$在$x$中一共出现多少次,求$\sum_{x=L}^{R}F(x)$。 如$S=22, F( 阅读全文
posted @ 2023-04-03 20:36 xhy666 阅读(47) 评论(0) 推荐(0)
摘要: A. Modulo Ruins the Legend $$ 求s、d,使\sum a_i +sn+d\frac{n(n+1)}{2} \ (\bmod m)最小\ 设sum = \sum a_i\ (\bmod m),t=gcd(n,\frac{n(n+1)}{2})\ 原式=sum+kt\ (\b 阅读全文
posted @ 2022-12-12 12:33 xhy666 阅读(1552) 评论(0) 推荐(1)
摘要: 原题链接 点分治,能够处理一些树上路径问题 模板细节很多 #include<bits/stdc++.h> using namespace std; #define fr first #define se second #define et0 exit(0); #define rep(i, a, b) 阅读全文
posted @ 2022-10-24 16:43 xhy666 阅读(46) 评论(0) 推荐(0)
1 2 3 4 5 ··· 13 下一页