2019 ICPC 南京网络赛 H-Holy Grail】的更多相关文章

As the current heir of a wizarding family with a long history,unfortunately, you find yourself forced to participate in the cruel Holy Grail War which has a reincarnation of sixty years.However,fortunately,you summoned a Caster Servant with a powerfu…
You're given a permutation aa of length nn (1 \le n \le 10^51≤n≤105). For each i \in [1,n]i∈[1,n], construct a sequence s_isi​ by the following rules: s_i[1]=isi​[1]=i; The length of s_isi​ is nn, and for each j \in [2, n]j∈[2,n], s_i[j] \le s_i[j-1]…
计蒜客题目链接:https://nanti.jisuanke.com/t/41303 题目:给你一个序列a,你可以从其中选取元素,构建n个串,每个串的长度为n,构造的si串要满足以下条件, 1. si[1]=i . 2. si[j]<si[j-1] 3. |pos[j] -pos[j-1]|<=k 并且每个a中的元素只能用一次 4. 两个串大小的定义时 前k项相等的前提(k和前面不是一个),Ck>Dk,则C大于D 求Si的长度,并输出 由于Si[ j ] < Si[j - 1] ,…
It is my great honour to introduce myself to you here. My name is Aloysius Benjy Cobweb Dartagnan Egbert Felix Gaspar Humbert Ignatius Jayden Kasper Leroy Maximilian. As a storyteller, today I decide to tell you and others a story about the hero Huri…
2019 ICPC 南昌网络赛 比赛时间:2019.9.8 比赛链接:The 2019 Asia Nanchang First Round Online Programming Contest 总结 // 史上排名最高一次,开场不到两小时队友各A一题加水题共四题,排名瞬间升至三四十名 // 然后后三小时就自闭了,一题都没有突破...最后排名211 hhhh     B. Fire-Fighting Hero 题意 队友做的,待补.   AC代码 #include<cstdio> #includ…
题意:有n个人,每个人有一件衣服需要洗,可以自己手洗花费t时间,也可以用洗衣机洗,但是洗衣机只有一台,即每个时刻最多只能有·一个人用洗衣机洗衣服.现在给你每个人最早可以开始洗衣服的时间,问当洗衣机的洗衣时间分别为1, 2....t的时候洗完所有衣服的最短时间. 思路:首先容易想到我们先把所有人按照洗衣服的时间排序.我们发现,最终洗衣服时间的瓶颈肯定在于后面的人,所以我们考虑怎么使用洗衣机使得总的洗衣时间最短.首先最后一个人是一定要用洗衣机洗衣服的,因为洗衣机的洗衣服时间 <= t, 那么最后一个…
题目: 给定一棵树, 带边权. 现在有2种操作: 1.修改第i条边的权值. 2.询问u到其他一个任意点的最大距离是多少. 题解: 树的直径可以通过两次 dfs() 的方法求得.换句话说,到任意点最远的点,一定是直径的某个端点(反证法). • 因此原问题转化为动态维护直径,然后再支持询问两个点的距离,后者可以 dfs 序 + lca + 树状数组. 参考代码: #include<bits/stdc++.h> #define lowbit(x) (x&-x) #define lson l,…
题解:n个集合,你要进行m个操作.总共有3种操作.第一种,合并两个集合x和y.第二张,把特定的集合里面所有的数字加一.第三种,询问在某个集合里面,对于所有数字对2的k次方取模后,有多少个数字等于x. 思路:我们可以对于每一个节点保存一个lazy标记,这个标记类似于线段树中的lazy标记.每次整个集合增加的时候,只改变lazy标记,然后在下一次访问这个节点的时候,再去把这个标记push_down.而这个push_down的方式就是按照之前说的那样,根据lazy的奇偶来判断是否应该交换儿子和额外进位…
目录 题目链接 思路 代码 题目链接 传送门 思路 首先我们将原式化简: \[ \begin{aligned} &\sum\limits_{l_1=1}^{n}\sum\limits_{l_2=1}^{n}\dots\sum\limits_{l_k=1}^{n}gcd(l_1,l_2,\dots,l_k)^2&\\ =&\sum\limits_{d=1}^{n}d^2\sum\limits_{l_1=1}^{n}\sum\limits_{l_2=1}^{n}\dots\sum\li…
Problem Similar to the strange ability of Martin (the hero of Martin Martin), Ghh will random occurrence in one of \(N\) cities every morning and the money will change to \(X\) RMB (No matter how much money had yesterday). Ghh finds that every \(N\)…