
思维
文章平均质量分 92
思维
_sky123_
这个作者很懒,什么都没留下…
展开
-
2021CCPC广州 H. Three Integers
题目链接You are given three non-negative integers aaa, bbb, and ccc. Find three positive integers xxx, yyy, and zzz that satisfy x mod y=ax\bmod y=axmody=a, y mod z=by\bmod z=bymodz=b, and z mod x=cz\bmod x=czmodx=c.InputThe first line contains an integer t原创 2021-11-17 01:03:08 · 2240 阅读 · 4 评论 -
The 2021 ICPC Asia Regionals Online Contest (II) A.Sort
Little A has an array a of length nnn , which is indexed from 111 to nnn. A total of nnn numbers are stored in a1,a2,⋯,ana_1 ,a_2,⋯,a_na1,a2,⋯,an , and little A wants to sort them in non-decreasing order.Little A can perform several rounds of operation原创 2021-09-28 20:03:54 · 202 阅读 · 0 评论 -
Codeforces Round #724 (Div. 2) F. Omkar and Akmar
题目链接Omkar and Akmar are playing a game on a circular board with nnn (2≤n≤1062 \leq n \leq 10^62≤n≤106) cells. The cells are numbered from 111 to nnn so that for each iii (1≤i≤n−11 \leq i \leq n-11≤i≤n−1) cell iii is adjacent to cell i+1i+1i+1 and cell 111原创 2021-08-12 21:22:07 · 142 阅读 · 0 评论 -
Codeforces Round #735 (Div. 2) E. You
题目链接You are given a tree with nnn nodes. As a reminder, a tree is a connected undirected graph without cycles.Let a1,a2,…,ana_1, a_2, \ldots, a_na1,a2,…,an be a sequence of integers. Perform the following operation exactly nnn times:Select an uneras原创 2021-08-05 20:56:32 · 94 阅读 · 0 评论 -
Codeforces Round #732 (Div. 2) E. AquaMoon and Permutations
题目链接Cirno has prepared nnn arrays of length nnn each. Each array is a permutation of nnn integers from 111 to nnn. These arrays are special: for all 1≤i≤n1 \leq i \leq n1≤i≤n, if we take the iii-th element of each array and form another array of length nn原创 2021-07-29 12:40:15 · 206 阅读 · 0 评论 -
2020ICPC上海 H.Rice Arrangement
题目链接题目描述The boundary of the table is a circle. n{n}n chairs are at n{n}n points on the circle whose convex hull is a regular polygon with n{n}n vertices. We name the points 0,…,n−10,\ldots, n-10,…,n−1 in counterclockwise order. The i{i}i-th bowl is at po原创 2021-06-03 19:27:59 · 227 阅读 · 0 评论 -
2020ICPC上海 L.Traveling in the Grid World
题目链接题目描述Consider a grid pattern with n{n}n rows and {m}m columns. There are (n+1)×(m+1)(n+1)\times(m+1)(n+1)×(m+1) grid points in total which is the intersections of n+1{n+1}n+1 horizontal lines and m+1{m+1}m+1 vertical lines. We number the horizontal li原创 2021-06-03 00:00:52 · 336 阅读 · 0 评论 -
2021ICPC山东省赛 C.Cat Virus
题目链接Formally, the vertices in a rooted tree will be marked black or white, and if a vertex is marked black, all the vertices in its subtree should also be marked black. Given a rooted tree, it’s easy to calculate the number of possible valid ways to mark原创 2021-06-02 20:30:32 · 742 阅读 · 0 评论 -
2021ICPC河南省赛 E.Dance with a stick
题目链接Megumi公司的晚会上,有一个节目正在彩排。在一个巨大的二维舞台上,有 nnn 个演员,编号为 1−n1-n1−n 和一根无限长的棍子。为了监视彩排,任意三位演员不在同一条直线上,而且棍子上画了一个单向箭头。这个节目的要求是:选定某一位演员x,并确定棍子箭头的指向,让这位演员拿着棍子,使得除他之外没有其他演员接触棍子。然后表演开始。表演进行时,拿着棍子的演员a会顺时针旋转,当棍子碰到另外一位演员b时,演员b会接过棍子并继续旋转。为了节目效果,导演艾洛想找某一位特定的演员和在棍子原创 2021-05-31 23:21:31 · 276 阅读 · 8 评论 -
2021ICPC河南省赛 B.Honeycomb
题目链接题目描述小F最近在研究蜂巢,如下图所示,这是一个蜂巢的横剖图,每一个格子都是一个正六边形,多个格子平铺构成一个无限大的平面。我们以中央的格子作为原点,按照下图规律,一圈一圈向外将每个格子都编上号。小F想知道,如果一个蜜蜂当前在编号为x的格子处,它想到达编号为y的格子,最优情况下它最少需要经过多少个格子(包含起点终点)。蜜蜂在蜂巢里只能爬行,也就是说它每次只能爬到相邻的格子里。你需要支持多组询问。输入描述:第一行,一个整数 T (1≤T≤100000)T\ (1 \leq T原创 2021-05-31 21:31:23 · 576 阅读 · 2 评论 -
2021ICPC昆明 J.Parallel Sort
题目链接题目描述As a master of parallel computing, schwer is recently considering about the method to achieve quick sorting on parallel computers. He needs your help!Given a permutation (p1,⋯ ,pn)(p_1,\cdots,p_n)(p1,⋯,pn) , you need to sort the permutation wi原创 2021-04-04 13:16:19 · 1802 阅读 · 6 评论 -
Educational Codeforces Round 82 (Rated for Div. 2) F. Number of Components
题目链接You are given a matrix n×mn \times mn×m, initially filled with zeroes. We define ai,ja_{i, j}ai,j as the element in the iii-th row and the jjj-th column of the matrix.Two cells of the matrix are connected if they share a side, and the elements in th原创 2021-02-27 17:08:48 · 178 阅读 · 0 评论 -
Educational Codeforces Round 90 (Rated for Div. 2) E. Sum of Digits
题目链接Let f(x)f(x)f(x) be the sum of digits of a decimal number xxx.Find the smallest non-negative integer xxx such that f(x)+f(x+1)+⋯+f(x+k)=nf(x) + f(x + 1) + \dots + f(x + k) = nf(x)+f(x+1)+⋯+f(x+k)=n.InputThe first line contains one integer ttt (1≤t≤原创 2021-02-20 10:17:27 · 156 阅读 · 0 评论 -
2020-2021 ICPC, NERC, Southern and Volga Russian Regional Contest B. Bakery
题目链接Monocarp would like to open a bakery in his local area. But, at first, he should figure out whether he can compete with other shops.Monocarp plans that the bakery will work for nnn days. On the iii-th day, aia_iai loaves of bread will be baked in th原创 2021-02-04 10:57:43 · 449 阅读 · 0 评论 -
Codeforces Round #698 (Div. 2) F. Nezzar and Nice Beatmap
题目链接Nezzar loves the game osu!.osu! is played on beatmaps, which can be seen as an array consisting of distinct points on a plane. A beatmap is called nice if for any three consecutive points A,B,CA,B,CA,B,C listed in order, the angle between these three原创 2021-02-02 00:34:20 · 144 阅读 · 0 评论 -
Codeforces Round #696 (Div. 2) E. What Is It?
题目链接Lunar rover finally reached planet X. After landing, he met an obstacle, that contains permutation ppp of length nnn. Scientists found out, that to overcome an obstacle, the robot should make ppp an identity permutation (make pi=ip_i = ipi=i for all原创 2021-01-31 21:54:18 · 180 阅读 · 1 评论 -
Codeforces Round #696 (Div. 2) D. Cleaning
题目链接During cleaning the coast, Alice found nnn piles of stones. The iii-th pile has aia_iai stones.Piles iii and i+1i + 1i+1 are neighbouring for all 1≤i≤n−11 \leq i \leq n - 11≤i≤n−1. If pile iii becomes empty, piles i−1i - 1i−1 and i+1i + 1i+1 doesn’t原创 2021-01-31 20:18:33 · 173 阅读 · 0 评论 -
Educational Codeforces Round 101 (Rated for Div. 2) E. A Bit Similar
Let’s call two strings aaa and bbb (both of length kkk) a bit similar if they have the same character in some position, i. e. there exists at least one i∈[1,k]i \in [1, k]i∈[1,k] such that ai=bia_i = b_iai=bi.You are given a binary string sss of length原创 2021-01-30 00:14:41 · 219 阅读 · 0 评论 -
2020ICPC济南 J.Tree Constructer
题目链接题目描述MianKing has a Graph Constructer : The input of it is a sequence a1...n (0≤ai<260)a_{1...n}~(0\leq a_i<2^{60})a1...n (0≤ai<260) and the output of it is an undirected graph with nnn nodes, edge (x,y)(x,y)(x,y) is in this graph原创 2021-01-02 19:32:53 · 498 阅读 · 0 评论 -
2020ICPC小米网络赛第二场 C.Data Structure Problem
题目链接题目描述Bobo has two sequences a1,a2,…,ana_1, a_2, \ldots, a_na1,a2,…,an and b1,b2,…,bnb_1, b_2, \ldots, b_nb1,b2,…,bn. He would like to perform the following operations:1 x y\text{1 }x\ y1 x y, change the value of axa_xax to原创 2020-12-31 00:21:13 · 254 阅读 · 0 评论 -
AtCoder Grand Contest 049A - Erasing Vertices
题目链接Problem StatementWe have a directed graph with NNN vertices numbered 111 to NNN. NNN strings of length NNN each, S1,S2,…,SNS_1,S_2,\ldots,S_NS1,S2,…,SN, represent the edges in the graph. Specifically, Si,jS_{i,j}Si,j is 1 if there is an edge from原创 2020-12-25 12:42:56 · 226 阅读 · 0 评论 -
2020CCPC绵阳 L. Lottery
题目链接Little Rabbit walks into a shopping mall and comes across a lottery activity. There are nnn boxes. Inside the iii-th box, there are xix_ixi balls labeled with 2ai2^{a_i}2ai. Little Rabbit can pick out any number (including zero) of balls from each b原创 2020-12-16 16:25:14 · 420 阅读 · 0 评论 -
Codeforces Round #670 (Div. 2) D. Three Sequences
题目链接You are given a sequence of nnn integers a1,a2,…,ana_1, a_2, \ldots, a_na1,a2,…,an.You have to construct two sequences of integers bbb and ccc with length nnn that satisfy:for every iii (1≤i≤n1\leq i\leq n1≤i≤n) bi+ci=aib_i+c_i=a_ibi+ci=aibb原创 2020-12-13 01:11:10 · 363 阅读 · 0 评论 -
Codeforces Global Round 12 D. Rating Compression
On the competitive programming platform CodeCook, every person has a rating graph described by an array of integers aaa of length nnn. You are now updating the infrastructure, so you’ve created a program to compress these graphs. The program works as follo原创 2020-12-09 23:39:00 · 209 阅读 · 0 评论 -
Codeforces Round #681 (Div. 1) B. Identify the Operations
题目链接We start with a permutation a1,a2,…,ana_1,a_2,…,a_na1,a2,…,an and with an empty array bbb. We apply the following operation kkk times.On the iii-th iteration, we select an index tit_iti (1≤ti≤n−i+1)(1≤t_i≤n−i+1)(1≤ti≤n−i+1), remove ati from the原创 2020-11-05 21:10:20 · 222 阅读 · 0 评论 -
ZOJ 3732 Graph Reconstruction
题目链接Let there be a simple graph with NNN vertices but we just know the degree of each vertex. Is it possible to reconstruct the graph only by these information?A simple graph is an undirected graph that has no loops (edges connected at both ends to the s原创 2020-10-02 15:15:00 · 1216 阅读 · 0 评论 -
Codeforces Good Bye 2018E. New Year and the Acquaintance Estimation
题目链接Bob is an active user of the social network Faithbug. On this network, people are able to engage in a mutual friendship. That is, if aaa is a friend of bbb, then bbb is also a friend of aaa. Each user thus has a non-negative amount of friends.This mo原创 2020-10-02 01:13:09 · 192 阅读 · 0 评论 -
2020 Multi-University Training Contest 10 Permutation Counting
Problem DescriptionFor a given permutation a1,a2,…,ana_1,a_2,\dots,a_na1,a2,…,an of length nnn, we defined the neighbor sequence bbb of aaa, the length of which is n−1n−1n−1, as following:bi={0 ai<ai+11 ai>ai+1b_i=\left\{\begin{matrix原创 2020-09-17 23:52:10 · 186 阅读 · 0 评论 -
2020 Multi-University Training Contest 10 Mine Sweeper
题目链接Problem DescriptionA mine-sweeper map can be expressed as an r×cr×cr×c grid, and each cell of the grid is either mine cell or non-mine cell. A mine cell has no number on it, while a non-mine cell has a number, the number of mine cells that share at l原创 2020-09-17 22:54:04 · 323 阅读 · 0 评论 -
P4696 [CEOI2011]Matching
题目链接对于整数序列 (a1,a2,⋯ ,an)(a_1,a_2,\cdots,a_n)(a1,a2,⋯,an) 和 1∼n1\sim n1∼n 的排列 (p1,p2,⋯ ,pn)(p_1,p_2,\cdots,p_n)(p1,p2,⋯,pn),称 (a1,a2,⋯ ,an)(a_1,a_2,\cdots,a_n)(a1,a2,⋯,an) 符合 (p1,p2,⋯ ,pn)(p_1,p_2,\cdots,p_n)(p1,p2,⋯,pn),当且仅当:{a}\{a\}{a} 中任意原创 2020-09-11 22:39:40 · 292 阅读 · 0 评论 -
AtCoder Beginner Contest 177 F - I hate Shortest Path Problem
题目链接Problem StatementThere is a grid of squares with H+1H+1H+1 horizontal rows and WWW vertical columns.You will start at one of the squares in the top row and repeat moving one square right or down. However, for each integer iii from 111 through HHH, y原创 2020-08-30 01:14:42 · 502 阅读 · 1 评论 -
2020 Multi-University Training Contest 2 It‘s All Squares
Problem DescriptionOne day when Little Q woke up, he found himself being inside a 2D pixel world. The world is a grid with n×mn×mn×m square cells. Little Q can only walk along the side of these cells, which means he can stay at a point (x,y)(x,y)(x,y) if原创 2020-08-29 19:50:49 · 186 阅读 · 0 评论 -
Codeforces Round #665 (Div. 2) F. Reverse and Swap
题目链接You are given an array a of length 2n2^n2n. You should process qqq queries on it. Each query has one of the following 444 types:Replace(x,k)Replace(x,k)Replace(x,k) — change axa_xax to kkk;Reverse(k)Reverse(k)Reverse(k) — reverse each subarray原创 2020-08-24 09:49:17 · 238 阅读 · 0 评论 -
Boboniu and String
Boboniu defines BN-string as a string s of characters ‘B’ and ‘N’.You can perform the following operations on the BN-string s:Remove a character of s.Remove a substring “BN” or “NB” of s.Add a character ‘B’ or ‘N’ to the end of s.Add a string “BN” or原创 2020-08-14 17:02:33 · 2080 阅读 · 0 评论 -
Boboniu Walks on Graph
Boboniu has a directed graph with nnn vertices and mmm edges.The out-degree of each vertex is at most kkk.Each edge has an integer weight between 111 and mmm. No two edges have equal weights.Boboniu likes to walk on the graph with some specific rules, w原创 2020-08-14 11:07:12 · 345 阅读 · 0 评论 -
Codeforces Round #658 (Div. 1) The Majestic Brown Tree Snake
There is an undirected tree of nnn vertices, connected by n−1n−1n−1 bidirectional edges. There is also a snake stuck inside of this tree. Its head is at vertex aaa and its tail is at vertex bbb. The snake’s body occupies all vertices on the unique simple p原创 2020-08-13 11:16:42 · 489 阅读 · 0 评论 -
Rarity and New Dress
Carousel Boutique is busy again! Rarity has decided to visit the pony ball and she surely needs a new dress, because going out in the same dress several times is a sign of bad manners. First of all, she needs a dress pattern, which she is going to cut out原创 2020-08-11 15:42:12 · 241 阅读 · 1 评论 -
Bicolored Segments
You are given nnn segments [l1,r1],[l2,r2],…,[ln,rn][l_1,r_1],[l_2,r_2],…,[l_n,r_n][l1,r1],[l2,r2],…,[ln,rn]. Each segment has one of two colors: the iii-th segment’s color is tit_iti.Let’s call a pair of segments iii and jjj bad if the following t原创 2020-08-10 19:29:42 · 290 阅读 · 0 评论 -
Pairs of Pairs
You have a simple and connected undirected graph consisting of nnn nodes and mmm edges.Consider any way to pair some subset of these nnn nodes such that no node is present in more than one pair.This pairing is valid if for every pair of pairs, the induce原创 2020-08-10 09:49:21 · 617 阅读 · 0 评论 -
Social Distancing
链接:https://ac.nowcoder.com/acm/contest/5672/A来源:牛客网题目描述Nowadays, the Kingdom of Dreamgrid is suffering from a national pandemic. Fortunately, president Baobao is working effectively with the Center for Disease Control (CDC) and they are trying their bes原创 2020-08-07 09:42:13 · 706 阅读 · 0 评论