
枚举
文章平均质量分 91
枚举
_sky123_
这个作者很懒,什么都没留下…
展开
-
2021CCPC河南省赛 F.军训
题目链接题目描述小i不喜欢军训,尤其是练队列。在军训时,小 iii 发现教官喜欢将 nnn 个人排成一个矩阵,记矩阵的长和宽为 aaa 和 bbb ,满足 n=abn=abn=ab , 1≤a≤b1≤a≤b1≤a≤b ,教官会选择 (b−a)(b−a)(b−a) 最小的方案。然而有时候 nnn 的值很尴尬,例如 n=52n=52n=52 时,(b−a)(b−a)(b−a) 的最小值为 (13−4)=9(13−4)=9(13−4)=9 ,这个差值太大,队列就会显得不美观。于是小 iii 想到了一个解原创 2021-11-02 16:12:36 · 256 阅读 · 2 评论 -
Codeforces Round #738 (Div. 2) D2. Mocha and Diana (Hard Version)
题目链接This is the hard version of the problem. The only difference between the two versions is the constraint on nnn. You can make hacks only if all versions of the problem are solved.A forest is an undirected graph without cycles (not necessarily connecte原创 2021-08-16 22:21:05 · 340 阅读 · 0 评论 -
Deltix Round, Spring 2021 D. Love-Hate
题目链接William is hosting a party for nnn of his trader friends. They started a discussion on various currencies they trade, but there’s an issue: not all of his trader friends like every currency. They like some currencies, but not others.For each William’原创 2021-08-13 16:27:50 · 129 阅读 · 0 评论 -
Codeforces Round #729 (Div. 2) D. Priority Queue
题目链接You are given a sequence AAA, where its elements are either in the form + x or -, where xxx is an integer.For such a sequence SSS where its elements are either in the form + x or -, define f(S)f(S)f(S) as follows:iterate through SSS's elements from原创 2021-08-06 13:58:23 · 190 阅读 · 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 评论 -
Educational Codeforces Round 111 D. Excellent Arrays
题目链接Let’s call an integer array a1,a2,…,ana_1, a_2, \dots, a_na1,a2,…,an good if ai≠ia_i \neq iai=i for each iii.Let F(a)F(a)F(a) be the number of pairs (i,j)(i, j)(i,j) (1≤i<j≤n1 \le i < j \le n1≤i<j≤n) such that ai+aj=i+ja_i + a_j = i +原创 2021-07-28 21:59:38 · 163 阅读 · 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 评论 -
2020ICPC EC-Final B.Rectangle Flip 2
题目链接Prof. Pang enters a trap room in a dungeon. The room can be represented by an nnn by mmm chessboard. We use (i,j)(i, j)(i,j) (1≤i≤n1\le i\le n1≤i≤n, 1≤j≤m1\le j\le m1≤j≤m) to denote the cell at the iii-th row and jjj-th column. Every second, the floor原创 2021-05-12 21:03:32 · 899 阅读 · 0 评论 -
Educational Codeforces Round 76 (Rated for Div. 2) D. Yet Another Monster Killing Problem
题目链接You play a computer game. In this game, you lead a party of mmm heroes, and you have to clear a dungeon with nnn monsters. Each monster is characterized by its power aia_iai. Each hero is characterized by his power pip_ipi and endurance sis_isi.Th原创 2021-03-12 08:33:53 · 151 阅读 · 0 评论 -
Educational Codeforces Round 105 (Rated for Div. 2) F. Delete The Edges
题目链接You are given an undirected connected graph consisting of nnn vertices and mmm edges. Your goal is to destroy all edges of the given graph.You may choose any vertex as the starting one and begin walking from it along the edges. When you walk along an原创 2021-03-08 23:50:53 · 198 阅读 · 0 评论 -
Codeforces Round #704 (Div. 2) E. Almost Fault-Tolerant Database
题目链接You are storing an integer array of length mmm in a database. To maintain internal integrity and protect data, the database stores nnn copies of this array.Unfortunately, the recent incident may have altered the stored information in every copy in th原创 2021-03-03 20:31:47 · 214 阅读 · 1 评论 -
Educational Codeforces Round 84 (Rated for Div. 2) D. Infinite Path
题目链接You are given a colored permutation p1,p2,…,pnp_1, p_2, \dots, p_np1,p2,…,pn. The iii-th element of the permutation has color cic_ici.Let’s define an infinite path as infinite sequence i,p[i],p[p[i]],p[p[p[i]]]…i, p[i], p[p[i]], p[p[p[i]]] \dotsi原创 2021-02-24 21:09:26 · 174 阅读 · 1 评论 -
Educational Codeforces Round 87 (Rated for Div. 2) G. Find a Gift
题目链接This is an interactive problem. Don’t forget to flush output after printing queries using cout.flush() or fflush(stdout) in C++ or similar functions in other programming languages.There are nnn gift boxes in a row, numbered from 111 to nnn from left原创 2021-02-23 19:30:16 · 214 阅读 · 0 评论 -
Educational Codeforces Round 89 (Rated for Div. 2) F. Jog Around The Graph
题目链接You are given a simple weighted connected undirected graph, consisting of nnn vertices and mmm edges.A path in the graph of length kkk is a sequence of k+1k+1k+1 vertices v1,v2,…,vk+1v_1, v_2, \dots, v_{k+1}v1,v2,…,vk+1 such that for each iii (1≤i原创 2021-02-21 16:56:23 · 196 阅读 · 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 评论 -
Codeforces Round #699 (Div. 2) E. Sorting Books
题目链接One day you wanted to read something, so you went to your bookshelf to grab some book. But when you saw how messy the bookshelf was you decided to clean it up first.There are nnn books standing in a row on the shelf, the iii-th book has color aia_ia原创 2021-02-06 09:40:12 · 293 阅读 · 0 评论 -
2020-2021 ICPC, NERC, Southern and Volga Russian Regional Contest M. Similar Sets
题目链接You are given nnn sets of integers. The iii-th set contains kik_iki integers.Two sets are called similar if they share at least two common elements, i. e. there exist two integers xxx and yyy such that x≠yx \ne yx=y, and they both belong to each o原创 2021-02-03 21:11:44 · 524 阅读 · 0 评论 -
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 98 (Rated for Div. 2) E. Two Editorials
题目链接Berland regional ICPC contest has just ended. There were mmm participants numbered from 111 to mmm, who competed on a problemset of nnn problems numbered from 111 to nnn. Now the editorial is about to take place. There are two problem authors, each of原创 2020-12-06 00:20:31 · 416 阅读 · 1 评论 -
P2387 [NOI2014]魔法森林
题目链接题目描述为了得到书法大家的真传,小 EEE 同学下定决心去拜访住在魔法森林中的隐士。魔法森林可以被看成一个包含 nnn 个节点 mmm 条边的无向图,节点标号为 1,2,3,…,n1,2,3,…,n1,2,3,…,n,边标号为 1,2,3,…,m1,2,3,…,m1,2,3,…,m。初始时小 EEE 同学在 111 号节点,隐士则住在 nnn 号节点。小 EEE 需要通过这一片魔法森林,才能够拜访到隐士。魔法森林中居住了一些妖怪。每当有人经过一条边的时候,这条边上的妖怪 就会对其发起攻击。幸运原创 2020-10-16 14:49:05 · 242 阅读 · 0 评论