构造
mmk27
这个作者很懒,什么都没留下…
展开
-
CodeForces - 1082D Maximum Diameter Graph 找最长直径
Graph constructive problems are back! This time the graph you are asked to build should match the following properties.The graph is connected if and only if there exists a path between every pair of...原创 2018-11-29 18:39:35 · 232 阅读 · 0 评论 -
Contest1789 - 2019年第二阶段我要变强个人训练赛第十二场 问题 B: Balanced Neighbors 构造
题目描述You are given an integer N. Build an undirected graph with N vertices with indices 1to N that satisfies the following two conditions:·The graph is simple and connected.·There exists an intege...原创 2019-07-08 09:35:48 · 198 阅读 · 0 评论 -
2019牛客暑期多校训练营(第六场)E Androgynos 原图与补图同构
题目链接:https://ac.nowcoder.com/acm/contest/886/E?&headNav=acm题意:构造一个图,使得它的补图和他同构题解:官方题解:做的时候大致也是这个思路• 首先两个图同构有个必要条件是边数要相同,也就是说n阶完全图的边数得是偶数• 若 n = 4k:• 先考虑一个更简单的情况,n=4,相信大家都会手构(如果你不会,还可...原创 2019-08-03 21:56:57 · 388 阅读 · 0 评论 -
2019杭电多校第7场 Final Exam HDU - 6651 思维
题目链接:https://vjudge.net/problem/HDU-6651题解:换位思考, 考虑如果我们是出题人会怎么让学生做不出 k 题, 即最坏情况.显然, 我们会挑出学 生复习得最少的 n−k + 1 道题, 让每道题的难度都等于他复习的时间.(田忌赛马的策略) 因此, 回到学生视角, 我们要让自己复习的最少的 n−k + 1 题复习时间总和 > m, 构造方式显 然。剩下的...原创 2019-08-13 20:24:41 · 458 阅读 · 0 评论 -
2019牛客暑期多校训练营(第八场) C CDMA 构造
链接:https://ac.nowcoder.com/acm/contest/888/C来源:牛客网CDMA时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 524288K,其他语言1048576KSpecial Judge, 64bit IO Format: %lld题目描述Gromah and LZR have entered the third leve...原创 2019-08-10 21:52:19 · 304 阅读 · 0 评论 -
CodeForces - 1208C Magic Grid 构造
题目连接:https://cn.vjudge.net/problem/CodeForces-1208C题解:因为都是4的倍数,想到二进制位的话应该是每四位一个整体,比如0-15,前两位表示行,后两位表示列,就能得到:0 1 2 34 5 6 78 9 10 1112 13 14 15这样异或结果都是0,然后每4*4的一个整体都这么赋值#include <bits/st...原创 2019-08-26 13:13:12 · 769 阅读 · 0 评论 -
2019百度之星 - 复赛 HDU-6727 Quasi Binary Search Tree 构造 二叉树
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6727题解:对于当前节点,肯定分为两个区间一个在左一个在右,就把小区间分到最小编号在的那个分支中,如果当前节点最小,那就尽可能让当前节点的标号小,思路很简单,可能我写麻烦了#include <bits/stdc++.h>using namespace std;typedef l...原创 2019-08-31 22:24:09 · 197 阅读 · 0 评论 -
2019 南京网络赛 A.The beautiful values of the palace 构造螺旋矩阵 + CDQ / 离线 + 树状数组
题目链接:https://nanti.jisuanke.com/t/41298题解:首先我们要把每个坐标的val求出来,很明显每一圈的个数是一个等差数列,第x圈 a[x] = -8x+4n+4,然后就是先等差前n项和求出之前每一圈的总个数,然后对于x 与yx + y 与n + 1 的大小 分4种情况,求出该点是该圈的第几个即可,然后用这就是个三维偏序问题,CDQ分治或者离线+树状数...原创 2019-09-02 13:13:44 · 330 阅读 · 3 评论 -
牛客练习赛51 C、勾股定理 只一边求另外两边 结论
链接:https://ac.nowcoder.com/acm/contest/1083/C来源:牛客网勾股定理时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536KSpecial Judge, 64bit IO Format: %lld题目描述给出直角三角形其中一条边的长度n,你的任务是构造剩下的两条边,使这三条边能构成一个直角三...原创 2019-09-07 10:11:28 · 456 阅读 · 0 评论 -
构造螺旋矩阵 n*m
构造n * m的螺旋矩阵讲解:https://wenku.baidu.com/view/7253dc78a26925c52cc5bff4.htm#include <bits/stdc++.h>using namespace std;int getnum(int n, int m, int x, int y) { int lev = min(min(x, n - 1 - ...原创 2019-09-16 14:43:59 · 1289 阅读 · 0 评论 -
HDU - 6285 Vertex Cover 思维构造
题目链接:https://cn.vjudge.net/problem/HDU-6285题意:n个点的完全图编号0-n-1,第i个点的权值为2^i,原先是先手选取一些边,然后后手选取一些点,满足先手选取的所有边对应的两点至少要有一个,并且总的权值和最少,现在给你后手选取的点得权值和,求先手选取边的方案数题解:因为权值是二进制的形式给的,所以对应1的位置即对应的这个点也选了,对于选取的点来说,...原创 2019-05-29 14:32:13 · 411 阅读 · 0 评论 -
CodeForces - 545B Equidistant String 构造
题目链接:点击查看Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her strings contain only digits zero and one. She uses the definition of Hamming...原创 2019-02-27 13:39:57 · 248 阅读 · 0 评论 -
CodeForces - 1118C Palindromic Matrix 构造 优先队列
Let's call some square matrix with integer values in its cells palindromic if it doesn't change after the order of rows is reversed and it doesn't change after the order of columns is reversed.For e...原创 2019-02-24 22:38:43 · 338 阅读 · 0 评论 -
CodeForces - 304D Rectangle Puzzle II
You are given a rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ ...原创 2018-11-28 14:16:23 · 150 阅读 · 0 评论 -
CodeForces - 312C The Closest Pair Co 构造
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted...原创 2018-11-28 14:59:43 · 190 阅读 · 0 评论 -
CodeForces - 459C Pashmak and Buses 构造
Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different pl...原创 2018-12-11 09:52:33 · 342 阅读 · 0 评论 -
Gym - 101911K Medians and Partition 思维
Let median of some array be the number which would stand in the middle of this array if it was sorted beforehand. If the array has even length let median be smallest of of two middle elements. For exa...原创 2018-12-17 17:24:13 · 650 阅读 · 0 评论 -
CodeForces - 451C Predict Outcome of the Game 构造
There are n games in a football tournament. Three teams are participating in it. Currently k games had already been played.You are an avid football fan, but recently you missed the whole k games. Fo...原创 2018-12-12 11:41:12 · 151 阅读 · 0 评论 -
Gym - 101911G Tree Reconstruction
StatementsMonocarp has drawn a tree (an undirected connected acyclic graph) and then has given each vertex an index. All indices are distinct numbers from 11 to nn. For every edge eeof this tree, Mo...原创 2018-12-18 19:56:16 · 725 阅读 · 0 评论 -
牛客网 Applese 走方格
题目链接:点击查看题解:我们容易发现到当n,m都为奇数时,是回不到原点的,因为你无论哪个方向走一去一回就是两步,所以n和m必然有一个偶数,那至于我们怎么走呢,看下图,注意的是n==1,m==2时和n==2,m==1时是可以的,其他n==1或m==1是不行的 #include<bits/stdc++.h>using namespace std;typedef lon...原创 2019-01-29 17:32:50 · 284 阅读 · 0 评论 -
CodeForces - 1118E Yet Another Ball Problem 构造
The king of Berland organizes a ball! nn pair are invited to the ball, they are numbered from 11 to nn. Each pair consists of one man and one woman. Each dancer (either man or woman) has a monochrome ...原创 2019-02-24 22:29:07 · 389 阅读 · 0 评论 -
CodeForces - 1220D Alex and Julian 二分图性质
题目链接:https://vjudge.net/problem/CodeForces-1220D题意:n个数,如果节点 i 和 j 满足 |i - j | 属于B,则i和j有一条边,问B集合最少删除多少边,使得得到的图是个二分图题解:根据二分图的性质,不能存在奇数环,也就是和a不能共存的数有,a*2,a*4......,假设a和b能共存,那么a和b的2的幂数是一样的,也就是2的因子数目一样...原创 2019-09-26 10:23:39 · 270 阅读 · 0 评论