![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
构造
文章平均质量分 71
旺 崽
这个作者很懒,什么都没留下…
展开
-
2021牛客寒假算法基础集训营1 I.限制不互素对的排列
2021牛客寒假算法基础集训营1 I.限制不互素对的排列题目链接题目描述输入一个数 ,请构造一个长度为 的排列,使得其中正好有 对相邻的数gcd(最大公约数)大于 。排列是指 到 一共 个数,每个数都出现过且仅出现过 次。例如, 是一个排列,而 、 则不是排列输入描述:两个整数 nnn 和 kkk,用空格隔开。2≤n≤100000,0≤k≤n/22\leq n\leq 100000,0\leq k \leq n/22≤n≤100000,0≤k≤n/2输出描述:如果不存在原创 2021-02-02 10:40:50 · 2045 阅读 · 0 评论 -
2021牛客寒假算法基础集训营1 B.括号
2021牛客寒假算法基础集训营1 B.括号题目链接题目描述请你构造一个非空的括号字符串,包含正好 kkk 个不同合法括号对。所谓括号字符串,是指由’(‘和’)'这两种字符构成的字符串。要求构造的字符串长度不超过 100000100000100000。输入描述:一个整数 kkk。0≤k≤1090\leq k \leq 10^90≤k≤109输出描述:一个仅包含左右括号字符串,其中有 kkk 个合法的括号对。如果有多种构造方法,输出任意一种合法方案即可。示例1输入3输出()()原创 2021-02-01 20:35:16 · 1783 阅读 · 0 评论 -
HDUOJ 6852 Increasing and Decreasing
HDUOJ 6852 Increasing and Decreasing题目链接Problem DescriptionNotice:Don’t output extra spaces at the end of one line.Given n,x,y, please construct a permutation of length n, satisfying that:The length of LIS(Longest Increasing Subsequence) is equal to原创 2020-09-19 10:28:36 · 2515 阅读 · 0 评论 -
Codeforces Round #666 (Div. 2) C. Multiples of Length
Codeforces Round #666 (Div. 2) C. Multiples of Length题目链接You are given an array a of n integers.You want to make all elements of a equal to zero by doing the following operation exactly three times:Select a segment, for each number in this segment we c原创 2020-09-02 21:00:04 · 2328 阅读 · 0 评论 -
Codeforces Round #638 (Div. 2) D. Phoenix and Science
Codeforces Round #638 (Div. 2) D. Phoenix and Science题目链接Phoenix has decided to become a scientist! He is currently investigating the growth of bacteria.Initially, on day 1, there is one bacterium with mass 1.Every day, some number of bacteria will spl原创 2020-06-18 19:50:47 · 2342 阅读 · 0 评论 -
Codeforces Round #649 (Div. 2) C. Ehab and Prefix MEXs
Codeforces Round #649 (Div. 2) C. Ehab and Prefix MEXs题目链接Given an array a of length n, find another array, b, of length n such that:for each i (1≤i≤n) MEX({b1, b2, …, bi})=ai.The MEX of a set of integers is the smallest non-negative integer that doe原创 2020-06-18 10:47:45 · 2341 阅读 · 0 评论 -
Codeforces Round #647 (Div. 2) - Thanks, Algo Muse! D. Johnny and Contribution
Codeforces Round #647 (Div. 2) - Thanks, Algo Muse! D. Johnny and ContributionToday Johnny wants to increase his contribution. His plan assumes writing n blogs. One blog covers one topic, but one topic can be covered by many blogs. Moreover, some blogs ha原创 2020-06-14 10:45:44 · 2400 阅读 · 0 评论 -
Codeforces Round #644 (Div. 3) G.A/B Matrix
Codeforces Round #644 (Div. 3) G.A/B Matrix题目链接You are given four positive integers n, m, a, b (1≤b≤n≤50; 1≤a≤m≤50). Find any such rectangular matrix of size n×m that satisfies all of the following conditions:each row of the matrix contains exactly a o原创 2020-05-25 15:13:51 · 2366 阅读 · 0 评论 -
2020 年 “游族杯” 全国高校程序设计网络挑战赛 I.Idiotic Suffix Array
2020 年 “游族杯” 全国高校程序设计网络挑战赛 I.Idiotic Suffix Array题目链接简单构造题,我是用 a,b,ca,b,ca,b,c 三个字母构造的,AC代码如下:#include<bits/stdc++.h>using namespace std;typedef long long ll;main(){ int n,k; cin>>n>>k; putchar('b'); for(int i=0;i原创 2020-05-24 15:12:35 · 2345 阅读 · 0 评论 -
Codeforces Round #643 (Div. 2) D.Game With Array
Codeforces Round #643 (Div. 2) D.Game With Array题目链接Petya and Vasya are competing with each other in a new interesting game as they always do.At the beginning of the game Petya has to come up with an array of N positive integers. Sum of all elements in原创 2020-05-17 11:46:07 · 2409 阅读 · 0 评论 -
Codeforces Round #642 (Div. 3) D.Constructing the Array
Codeforces Round #642 (Div. 3) D.Constructing the Array题目链接You are given an array a of length n consisting of zeros. You perform n actions with this array: during the i-th action, the following sequence of operations appears:Choose the maximum by length原创 2020-05-15 19:33:08 · 2364 阅读 · 0 评论 -
Codeforces Round #640 (Div. 4) G.Special Permutation
Codeforces Round #640 (Div. 4) G.Special Permutation题目链接A permutation of length n is an array p=[p1,p2,…,pn], which contains every integer from 1 to n (inclusive) and, moreover, each number appears exactly once. For example, p=[3,1,4,2,5] is a permutatio原创 2020-05-13 15:21:40 · 2336 阅读 · 0 评论 -
Codeforces Round #640 (Div. 4) F.Binary String Reconstruction
Codeforces Round #640 (Div. 4) F.Binary String Reconstruction题目链接For some binary string s (i.e. each character si is either ‘0’ or ‘1’), all pairs of consecutive (adjacent) characters were written. In other words, all substrings of length 2 were written.原创 2020-05-13 14:59:09 · 2306 阅读 · 0 评论 -
Educational Codeforces Round 85 (Rated for Div. 2) D.Minimum Euler Cycle
Educational Codeforces Round 85 (Rated for Div. 2) D.Minimum Euler Cycle题目链接You are given a complete directed graph Kn with n vertices: each pair of vertices u≠v in Kn have both directed edges (u,v)...原创 2020-04-12 10:35:59 · 2281 阅读 · 0 评论 -
Codeforces Round #631 (Div. 2) C.Dreamoon Likes Coloring
Codeforces Round #631 (Div. 2) C.Dreamoon Likes Coloring题目链接Dreamoon likes coloring cells very much.There is a row of n cells. Initially, all cells are empty (don’t contain any color). Cells are nu...原创 2020-04-05 15:42:52 · 2397 阅读 · 0 评论 -
Codeforces Round #630 (Div. 2) D.Walk on Matrix
Codeforces Round #630 (Div. 2) D.Walk on Matrix题目链接Bob is playing a game named “Walk on Matrix”.In this game, player is given an n×m matrix A=(ai,j), i.e. the element in the i-th row in the j-th co...原创 2020-04-03 10:40:20 · 2350 阅读 · 0 评论 -
Codeforces Round #630 B.Composite Coloring
Codeforces Round #630 B.Composite Coloring题目链接A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following n...原创 2020-04-01 11:19:23 · 2325 阅读 · 2 评论 -
Codeforces Round #629 (Div. 3) D.Carousel
Codeforces Round #629 (Div. 3) D.CarouselThe round carousel consists of n figures of animals. Figures are numbered from 1 to n in order of the carousel moving. Thus, after the n-th figure the figure ...原创 2020-03-27 16:30:12 · 2443 阅读 · 0 评论 -
Frog and Portal
Frog and PortalA small frog wants to get to the other side of a river. The frog is initially located at one bank of the river (position 0) and wants to get to the other bank (position 200). Luckily, ...原创 2020-03-25 15:50:07 · 2284 阅读 · 0 评论