Swap There is a sequence of numbers of length nn, and each number in the sequence is different. There are two operations: Swap the first half and the last half of the sequence (if nn is odd, the middle number does not change) Swap all the numbers in…
Tree Ming and Hong are playing a simple game called nim game. They have nn piles of stones numbered 11 to nn ,the ii-th pile of stones has a_iai​ stones. There are n - 1n−1 bidirectional roads in total. For any two piles, there is a unique path from…
Travel There are nn planets in the MOT galaxy, and each planet has a unique number from 1 \sim n1∼n. Each planet is connected to other planets through some transmission channels. There are mm transmission channels in the galaxy. Each transmission cha…
Angel's Journey “Miyane!” This day Hana asks Miyako for help again. Hana plays the part of angel on the stage show of the cultural festival, and she is going to look for her human friend, Hinata. So she must find the shortest path to Hinata’s house.…
Tasks It's too late now, but you still have too much work to do. There are nn tasks on your list. The ii-th task costs you t_iti​seconds. You want to go to bed TT seconds later. During the TT seconds, you can choose some tasks to do in order to finis…
A prime number (or a prime) is a natural number greater than 11 that cannot be formed by multiplying two smaller natural numbers. Now lets define a number NN as the supreme number if and only if each number made up of an non-empty subsequence of all…
先写这几道题,比赛的时候有事就只签了个到. 题目传送门 E. Excellent Engineers 传送门 这个题的意思就是如果一个人的r1,r2,r3中的某一个比已存在的人中的小,就把这个人添加到名单中. 因为是3个变量,所以按其中一个变量进行sort排序,然后,剩下的两个变量,一个当位置pos,一个当值val,通过线段树的单点更新和区间最值操作,就可以把名单确定. 代码: //E-线段树 #include<iostream> #include<cstdio> #include…
链接 : Here! 思路 : 如果用 $STL$ 的 $map$ 或者是使用 $unordered\underline{}map$ 的话是会 $T$ 的, 所以得手写一个 $hash表$. 其实这个题题意一开始看的话还是蛮难以理解的. 但是如果理解了题意, 这道题就非常简单了. 题目样例解析 : 小 $K$ 一共采访了 $5$ 个同学, 他们反馈的结果是 $1, 1, 2, 2, 3$ . 那么, 最优解为 $9$, 下面给出一个表, 表示最优解的详细情况. 首先先给 $5$ 名同学编号 $1…
题目链接:http://codeforces.com/gym/101149/problem/L 题目大意:有n个点(其实是n+1个点,因为编号是0~n),m条有向边.起点是0,到a和b两个节点,所经过的最少的节点的数目是多少?(a和b也算,0不算) 思路: 真的是想了半天了,不知道怎么做,虽然知道是最短路,还是偏离了方向.最后万不得已的翻了题解. 题解看的是这个人的:链接 思路大体就是: 因为如果要到两个点,路径上的点肯定是有相交点的(因为0是必然要走的).然后如果两者路径相交,肯定选择共同相交…
ICPC官网题面假的,要下载PDF,点了提交还找不到结果在哪看(我没找到),用VJ交还直接return 0;也能AC 计蒜客题面 这个好 Time limit 3000 ms OS Linux 题目来源 ACM-ICPC 2017 Asia Xi'an VJ爬到的英文题面什么鬼啊,除了标题,哪里有xor字样啊?\((A[i_1], A[i_2], . . . , A[i_t])\)意思是gcd啊?简直了. 计蒜客的题面 2000ms 是不是计蒜客评测姬快一点,时限少了1s 262144K Con…