Grand

AtCoder Grand Contest 029

A - Irreversible operation 对于某个 W 的位置,它的贡献即为前面 B 的个数,直接搞就完事了。 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int N=2 ......
AtCoder Contest Grand 029

AtCoder Grand Contest 048

A - atcoder < S 枚举操作完的串 \(s\) 和 atcoder 相同的前缀长度,算出前面的前缀相同的代价加上当前这位大于 atcoder 中对应的那一位的代价即为达到当前状态的代价,取个最小值即可。 #include<iostream> #include<cstdio> #inclu ......
AtCoder Contest Grand 048

AtCoder Grand Contest 047

A - Integer Product 考虑将原来的数全部化为整数,乘上 \(10^9\),那么问题就变成了是否有两个数的乘积是 \(10^{18}\) 的倍数。考虑如果是 \(10^{18}\) 的倍数的话必然是 \(2^{18}\) 和 \(5^{18}\) 的倍数,那么分解出每个数的 \(2, ......
AtCoder Contest Grand 047

AtCoder Grand Contest 046

A - Takahashikun, The Strider 问题就是要你求 \(ax\equiv 0 \pmod{360}\) 中 \(a\) 的最小值。 答案就是 \(a=\frac{360}{\gcd(x,360)}\)。 代码: #include<iostream> #include<cstd ......
AtCoder Contest Grand 046

AtCoder Grand Contest 045

A - Xor Battle 可以发现,从后往前扫,遇到一个 \(1\) 找后面是否有若干个 \(0\) 的位置的 \(a_i\) 与当前位置的异或和相等,用线性基维护一下就好了。 代码: #include<iostream> #include<cstdio> #include<cstring> u ......
AtCoder Contest Grand 045

AtCoder Grand Contest 044

A - Pay to Win 不妨将操作倒过来考虑,问题就变成了每次除以 \(2,3,5\) 或者 \(+1,-1\),令 \(f_n\) 表示将 \(n\) 变成 \(0\) 的最小花费,然后记忆化搜索即可,可以证明复杂度是对的。 代码: #include<iostream> #include<c ......
AtCoder Contest Grand 044

AtCoder Grand Contest 043

A - Range Flip Find Route 可以发现,一条路径的最小操作数等于路径上有多少 # 的块,令 \(f_{i,j}\) 表示到 \((i,j)\) 的最小操作次数,直接 DP 就行了。 注意路径上一个 \(1\) 的块会被算两次,需要除以 \(2\)。 #include<iostr ......
AtCoder Contest Grand 043

AtCoder Grand Contest 046 E Permutation Cover

洛谷传送门 AtCoder 传送门 若 \(2\min\limits_{i = 1}^m a_i < \max\limits_{i = 1}^n a_i\) 就无解,因为根据排列的性质必然存在 \(yxxxy\) 或两端 \(xxyy\) 的情况,并且若这个条件不满足,就可以构造一组解。 考虑最小化 ......
Permutation AtCoder Contest Grand Cover

AtCoder Grand Contest 017

链接 C. Snuke and Spells 容易发现合法序列排序后一定是若干段值域连续的部分组成: 可以发现最小次数就是重叠/空出的部分大小。 每次修改只会对 \(O(1)\) 个点 \(±1\),直接维护即可。 #include<iostream> #include<cstdio> #inclu ......
AtCoder Contest Grand 017

AtCoder Grand Contest 023 E Inversions

洛谷传送门 AtCoder 传送门 首先将 \(a\) 从小到大排序,设 \(p_i\) 为排序后的 \(a_i\) 位于原序列第 \(p_i\) 个位置,\(x_i\) 为要填的排列的第 \(i\) 个数。 设 \(A = \prod\limits_{i = 1}^n (a_i - i + 1)\ ......
Inversions AtCoder Contest Grand 023

AtCoder Grand Contest 063

Preface AGC好难啊,这场补完最近就没啥比赛好补了,接下来去训练下专题吧 像C题这种美妙的人类智慧题感觉以我的脑子一辈子也想不出来www A - Mex Game 对于任意一段前缀,我们可以求出对应的每个人的操作次数以及每个人拥有的位置数 考虑Alice的最优策略一定是从小到大地放入Bob对 ......
AtCoder Contest Grand 063

AtCoder Grand Contest 058 F Authentic Tree DP

洛谷传送门 AtCoder 传送门 人生中第一道 AtCoder 问号题。 设 \(P = 998244353\)。 注意到 \(f(T)\) 的定义式中,\(\frac{1}{n}\) 大概是启示我们转成概率去做。发现若把 \(\frac{1}{n}\) 换成 \(\frac{1}{n - 1}\ ......
Authentic AtCoder Contest Grand Tree

AtCoder Grand Contest 041 F Histogram Rooks

[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc041_f "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc041/tasks/agc041_f "AtCoder 传送门") 神题!!!!!!! ......
Histogram AtCoder Contest Grand Rooks

AtCoder Grand Contest 064

# Preface AGC好难啊,从C题开始就一点不会了,感觉以前OI时候的AGC没那么变态的啊,也许是我变菜好多了吧 # **A - i i's** 考虑先放一个这样的序列: $$ n,n-1,n,n-1,n\cdots,n-1,n,n-2 $$ 这样就把$n,n-1$都用完了,同时还用了个$n- ......
AtCoder Contest Grand 064

Atcoder Grand Contest 058 F - Authentic Tree DP

考虑给 $f(T)$ 赋予组合意义。一个直观的想法是,在每条边中间新建一个节点,然后每次选择一条边对应的点,然后把它删掉,递归剩余的两个部分,但是你会发现这样分母不对,应该是 $n$ 但在这个模型里只有 $n-1$。 考虑魔改这个模型。我们在每个边对应的点下面添加 $998244352$ 个点,你发 ......
Authentic Atcoder Contest Grand Tree

AtCoder Grand Contest 040 E Prefix Suffix Addition

[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc040_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc040/tasks/agc040_e "AtCoder 传送门") 比较神奇的题。 考 ......
Addition AtCoder Contest Prefix Suffix

Atcoder Grand Contest 057 D - Sum Avoidance

先来找些性质: - $A$ 中最小的元素 $M$ 肯定是最小的不是 $S$ 的因子的数,由于 $\text{lcm}(1,2,3,\cdots,43)>10^{18}$,所以 $M\le 43$。 - 对于每个 $0\le iS)break; for(int j=1;j>1; if(calc(mid ......
Avoidance Atcoder Contest Grand 057

AtCoder Grand Contest 049 E Increment Decrement

[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc049_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc049/tasks/agc049_e "AtCoder 传送门") 好题。同时考查了 ......
Decrement Increment AtCoder Contest Grand

AtCoder Grand Contest 032 D Rotation Sort

[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc032_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc032/tasks/agc032_d "AtCoder 传送门") 设 $b_i$ 为 ......
Rotation AtCoder Contest Grand Sort

AtCoder Grand Contest 012 D Colorful Balls

[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc012_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc012/tasks/agc012_d "AtCoder 传送门") 不错的题。bx E ......
Colorful AtCoder Contest Grand Balls

XXI Opencup, Grand Prix of Korea

[TOC] ## XXI Opencup, Grand Prix of Korea OpenCup强度这么大吗( ### A 根据 Hall 定理, 把 $a$ 从大到小排序对于 $\forall x \in [1, n]$ 如果有 $\sum_{i = 1} ^ xa_i \leq \sum_{i ......
Opencup Grand Korea Prix XXI

AtCoder Grand Contest 058 D Yet Another ABC String

[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc058_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc058/tasks/agc058_d "AtCoder 传送门") Orz H6_6Q ......
AtCoder Another Contest String Grand

AtCoder Grand Contest 033 D Complexity

[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc033_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc033/tasks/agc033_d "AtCoder 传送门") 这题感觉实在太 e ......
Complexity AtCoder Contest Grand 033

AtCoder Grand Contest 021 E Ball Eat Chameleons

[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc021_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc021/tasks/agc021_e "AtCoder 传送门") 容易发现一个变色龙 ......
Chameleons AtCoder Contest Grand Ball

Grub(GNU GRand Unified Bootloader)是由GNU项目开发的开源引导加载程序。它的起源可以追溯到1995年,最初由Erich Boleyn、Gordon Matzigkeit和Brian Dean共同开发。 Grub的设计目标是创建一个强大而灵活的引导加载程序,能够支持多种操作系统,并提供用户友好的界面和配置选项

Grub是一款广泛使用的开源引导加载程序,用于启动计算机操作系统。它是GNU项目的一部分,并支持多种操作系统,包括Linux、Windows、Mac OS和其他许多操作系统。 Grub具有强大的功能和灵活性,可以在多个硬盘和分区上引导操作系统。它支持多种引导选项和配置文件,可以通过编辑配置文件进行自 ......
程序 项目开发 Grub 起源 Bootloader

GRUB(GNU GRand Unified Bootloader)是一个常用的引导加载程序,用于在计算机启动时加载操作系统。它是开源软件,由GNU项目开发并得到广泛应用

GRUB(GNU GRand Unified Bootloader)是一个常用的引导加载程序,用于在计算机启动时加载操作系统。它是开源软件,由GNU项目开发并得到广泛应用。 GRUB主要有两个版本:GRUB Legacy和GRUB 2。GRUB 2是较新的版本,也是目前更常用和推荐的版本。下面主要介 ......
项目开发 Bootloader GNU 常用 Unified

Atcoder Grand Contest 062 D - Walk Around Neighborhood

csy/bx wjz/bx 首先将 $a$ 排序,如果 $\sum\limits_{i=1}^{n-1}a_id$ 的元素 $x$,满足 $\le d$ 的元素之和 $\ge x-d$,那我们肯定可以先走到 $(x-d,0)$ 然后一步走到 $(-d,0)$,否则可以证明是不行的。 从全局的角度考虑 ......
Neighborhood Atcoder Contest Around Grand

「解题报告」XXI Open Cup, Grand Prix of Tokyo

猜猜为什么四五天没更博了?~~攒了个大的。~~ ~~非常好 OpenCup,10 个 998244353,爱来自陶瓷❤~~ 快写死我了,终于写完了。 十道题里只有三道题是自己做出来的。我好废物。 [Codeforces Gym](https://codeforces.com/gym/102978) ......
报告 Grand Tokyo Open Prix

Atcoder Grand Contest 060 D - Same Descent Set

先推式子。设 $f(S)$ 表示 decent 集合恰好为 $S$ 的排列个数,$g(S)$ 表示 $S$ 是 $p$ 的 decent 集合的一个子集的排列 $p$ 个数,$g'(\{a_1,a_2,\cdots,a_k\})=\dfrac{n!}{a_1!(a_2-a_1)!(a_3-a_2)! ......
Atcoder Contest Descent Grand Same

AtCoder Grand Contest 062 B Split and Insert

[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc062_b "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc062/tasks/agc062_b "AtCoder 传送门") 妙妙题。 像这种最 ......
AtCoder Contest Insert Grand Split