思维、构造、模拟
文章平均质量分 83
培养思维
依旧Lily
发自己的光就好,别去吹灭别人的灯。
展开
-
Sifid and Strange Subsequences(思维)
A sequence (b1,b2,…,bk) is called strange, if the absolute difference between any pair of its elements is greater than or equal to the maximum element in the sequence. Formally speaking, it’s strange if for every pair (i,j) with 1≤i<j≤k, we have |ai−aj|原创 2021-06-19 08:40:38 · 269 阅读 · 0 评论 -
Potions (Easy Version) CodeForces - 1526C1(优先队列)
先讲一下优先队列:top 访问队头元素empty 判断队列是否为空size 返回队列内元素个数push 插入元素到队尾 (并排序)pop 弹出队头元素swap 交换内容升序和降序优先队列:升序队列priority_queue <int,vector,greater > q;降序队列priority_queue <int,vector,less >q;题目链接:https://vjudge.z180.cn/problem/CodeForces-1526C1原创 2021-06-03 21:27:03 · 646 阅读 · 0 评论 -
Epic Transformation(思维)
You are given an array a of length n consisting of integers. You can apply the following operation, consisting of several steps, on the array a zero or more times:you select two different numbers in the array ai and aj;you remove i-th and j-th elements f原创 2021-05-31 21:13:56 · 319 阅读 · 0 评论 -
k-LCM (easy version) CodeForces - 1497C1(思维+构造/n分奇偶)
It is the easy version of the problem. The only difference is that in this version k=3.You are given a positive integer n. Find k positive integers a1,a2,…,ak, such that:a1+a2+…+ak=nLCM(a1,a2,…,ak)≤n2Here LCM is the least common multiple of numbers a1,原创 2021-05-31 20:51:39 · 330 阅读 · 0 评论 -
M-arrays(思维+取余)
You are given an array a1,a2,…,an consisting of n positive integers and a positive integer m.You should divide elements of this array into some arrays. You can order the elements in the new arrays as you want.Let’s call an array m-divisible if for each t原创 2021-05-31 20:36:29 · 538 阅读 · 0 评论 -
Permutation Sort(思维)
You are given a permutation a consisting of n numbers 1, 2, …, n (a permutation is an array in which each element from 1 to n occurs exactly once).You can perform the following operation: choose some subarray (contiguous subsegment) of a and rearrange the原创 2021-05-29 08:37:35 · 504 阅读 · 0 评论 -
Balance the Bits(构造)
A sequence of brackets is called balanced if one can turn it into a valid math expression by adding characters ‘+’ and ‘1’. For example, sequences ‘(())()’, ‘()’, and ‘(()(()))’ are balanced, while ‘)(’, ‘(()’, and ‘(()))(’ are not.You are given a binary原创 2021-05-29 08:21:54 · 224 阅读 · 0 评论 -
A-B Palindrome(回文串 暴力模拟)
You are given a string s consisting of the characters ‘0’, ‘1’, and ‘?’. You need to replace all the characters with ‘?’ in the string s by ‘0’ or ‘1’ so that the string becomes a palindrome and has exactly a characters ‘0’ and exactly b characters ‘1’. No原创 2021-05-28 21:39:03 · 336 阅读 · 1 评论 -
Corrupted Array(思维)
You are given a number n and an array b1,b2,…,bn+2, obtained according to the following algorithm:some array a1,a2,…,an was guessed;array a was written to array b, i.e. bi=ai (1≤i≤n);The (n+1)-th element of the array b is the sum of the numbers in the a原创 2021-05-28 21:31:26 · 326 阅读 · 0 评论 -
Permutation by Sum(思维+构造)
A permutation is a sequence of n integers from 1 to n, in which all the numbers occur exactly once. For example, [1], [3,5,2,1,4], [1,3,2] are permutations, and [2,3,2], [4,3,1], [0] are not.Polycarp was given four integers n, l, r (1≤l≤r≤n) and s (1≤s≤n(原创 2021-05-28 21:10:08 · 336 阅读 · 0 评论