![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二进制
文章平均质量分 81
tomjobs
别慌,慌也没用
展开
-
Codeforces-1491 D. Zookeeper and The Infinite Zoo(二进制,思维)
There is a new attraction in Singapore Zoo: The Infinite Zoo. The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled 1,2,3,…. There is a directed edge from vertex ???? to vertex ????+???? if and only if ????&????=???原创 2021-03-01 14:24:49 · 345 阅读 · 1 评论 -
D - Experiment! Gym - 102911E(交互,海明码,二进制)
This is an interactive problem. The PIPAC (Philippine Institute of Pure and Applied Chemistry) is an independent scientific institute which lies between Faura Hall and the School of Management in the Ateneo de Manila University. Despite residing in Ateneo,原创 2021-01-26 22:02:19 · 251 阅读 · 0 评论 -
Codeforces1457 D. XOR-gun(二进制)
Arkady owns a non-decreasing array ????1,????2,…,????????. You are jealous of its beauty and want to destroy this property. You have a so-called XOR-gun that you can use one or more times. In one step you can select two consecutive elements of the array, l原创 2020-11-29 21:50:56 · 384 阅读 · 5 评论 -
Codeforces 1451E2. Bitwise Queries (Hard Version)(交互,二进制)
The only difference between the easy and hard versions is the constraints on the number of queries. This is an interactive problem. Ridbit has a hidden array ???? of ???? integers which he wants Ashish to guess. Note that ???? is a power of two. Ashish is原创 2020-11-22 14:45:47 · 298 阅读 · 0 评论 -
2020 CCPC绵阳7-12 Lottery(组合数学,二进制)
题意: 2a[i]2^{a[i]}2a[i]有nnn个,问能组合出多少种数字。 思路: 如果前i−1i-1i−1个数的总和大于2a[i]2^{a[i]}2a[i],那就把前iii个2b2^b2b合起来算结果。 最后总的结果就是每一段的乘积。 不妨设a[i]=2i−1a[i]=2^{i-1}a[i]=2i−1,则对于连续一段数1 j1~j1 j,每次考虑仅选择前iii个数,后面的数都先不用。第iii个数为2a[i]2^{a[i]}2a[i],有b[i]b[i]b[i]个。 对于前i−1i.原创 2020-11-05 23:26:16 · 388 阅读 · 0 评论 -
Codeforces 1408 F. Two Different(二进制)
You are given an integer ????. You should find a list of pairs (????1,????1), (????2,????2), …, (????????,????????) (1≤????????,????????≤????) satisfying the following condition. Let’s consider some function ????:ℕ×ℕ→ℕ (we define ℕ as the set of positive i原创 2020-10-02 20:17:12 · 202 阅读 · 0 评论 -
Codeforces Global Round 10 E. Omkar and Duck(构造,二进制)
题意: 交互题,实质是要求构成一个n*m的矩形,使得起点到终点只能往左下走的任意一条路径权值和不同。 思路: 按这样排列矩阵就好了(图自官方题解)。 那么可以发现,当iii为奇数时,a[i][j]=0a[i][j]=0a[i][j]=0。否则a[i][j]=2i+ja[i][j]=2^{i+j}a[i][j]=2i+j 那么假设到了位置(x,y)(x,y)(x,y),且满足a[x][y]!=0a[x][y]!=0a[x][y]!=0,从(1,1)(1,1)(1,1)到(x−1,y)(x-1,y)(x−1原创 2020-09-21 19:46:01 · 221 阅读 · 0 评论 -
Codeforces1327 F. AND Segments(DP优化,按位)
You are given three integers ????, ????, ???? and ???? conditions (????1,????1,????1),(????2,????2,????2),…,(????????,????????,????????). Calculate the number of distinct arrays ????, consisting of ???? integers such that: 0≤????????<2???? for each 1≤??原创 2020-09-04 15:47:42 · 213 阅读 · 0 评论 -
Codeforces C. Boboniu and Bit Operations(按位或者状压)
Boboniu likes bit operations. He wants to play a game with you. Boboniu gives you two sequences of non-negative integers ????1,????2,…,???????? and ????1,????2,…,????????. For each ???? (1≤????≤????), you’re asked to choose a ???? (1≤????≤????) and let ???原创 2020-08-13 11:53:43 · 333 阅读 · 0 评论 -
F - Anton and School CodeForces - 734F(二进制)
Anton goes to school, his favorite lessons are arraystudying. He usually solves all the tasks pretty fast, but this time the teacher gave him a complicated one: given two arrays b and c of length n, find array a, such that: where a and b means bitwise AND,原创 2020-08-01 23:49:59 · 203 阅读 · 0 评论 -
牛客算法周周练15 璀璨光滑(BFS,二进制)
思路: 一开始看成了只有连边才有一个二进制位不同,这样的话题解对 1 2 3 1 2 2 3 3 4 的输出就成了0 1 1 1,就不对了。 后来知道,意思是只要有二进制位不同,就能连边。 这就好办了,我们肯定能确定f[1]=0f[1]=0f[1]=0,那么连边的两个点,二进制中1的数目相差为1。 那么与1最短距离为1的点,二进制位有1个1,最短距离为2的点,二进制位有2个1。我们对这个过程跑bfs,最后就能得到一组解。 但是要求字典序最小。可以得到,对所有数的二进制位进行交换,仍然为解。则我们对二进制位.原创 2020-07-17 23:15:49 · 230 阅读 · 0 评论 -
Greater and Greater(bitset) 2020牛客暑期多校训练营(第二场)
思路: 看题解的时候可以结合这篇博客 首先我们要搞清楚维护的是啥。 我们对每一个a[i]a[i]a[i]维护一个mmm位的bitset,表示a[i]a[i]a[i]是否大于b[j]b[j]b[j]。 这样的bitsetbitsetbitset最多只有mmm种,因为bbb数组就m个数字,这个有单调性。 所以我们可以预处理出这mmm种bitsetbitsetbitset,然后a[i]a[i]a[i]在bbb中二分一下就知道其对应的bitsetbitsetbitset了。 维护好了每一个a[i]a[i]a[i].原创 2020-07-14 20:43:17 · 205 阅读 · 0 评论 -
ICPC Central Europe Regional Contest 2019 F. Light Emitting Hindenburg(二进制)
Lothar is organizing a concert tour of his friends’ rock band. The tour will take place in November and each day there will be at most one concert. The tour will be very representativeand many musicians are willing to take part in it. The number of musicia原创 2020-06-21 20:55:09 · 397 阅读 · 0 评论 -
BZOJ3687. 简单题(bitset)
Description 小呆开始研究集合论了,他提出了关于一个数集四个问题: 1.子集的异或和的算术和。 2.子集的异或和的异或和。 3.子集的算术和的算术和。 4.子集的算术和的异或和。 目前为止,小呆已经解决了前三个问题,还剩下最后一个问题还没有解决,他决定把 这个问题交给你,未来的集训队队员来实现。 Input 第一行,一个整数n。 第二行,n个正整数,表示01,a2….,。 Output ...原创 2020-02-12 12:26:19 · 260 阅读 · 0 评论 -
E. Tournament 1260E(dp,贪心)
You are organizing a boxing tournament, where ???? boxers will participate (???? is a power of 2), and your friend is one of them. All boxers have different strength from 1 to ????, and boxer ???? wins in the mat...原创 2019-12-01 20:42:14 · 385 阅读 · 0 评论 -
ACWING164. 可达性统计(bitset,拓扑排序)
给定一张N个点M条边的有向无环图,分别统计从每个点出发能够到达的点的数量。 输入格式 第一行两个整数N,M,接下来M行每行两个整数x,y,表示从x到y的一条有向边。 输出格式 输出共N行,表示每个点能够到达的点的数量。 数据范围 1≤N,M≤30000 输入样例: 10 10 3 8 2 3 2 5 5 9 5 9 2 3 3 9 4 8 2 10 4 9 输出样例: 1 6 3 3 2 1 1 ...原创 2019-11-03 12:13:47 · 237 阅读 · 0 评论 -
C. p-binary CF1247C(暴力,二进制)
Vasya will fancy any number as long as it is an integer power of two. Petya, on the other hand, is very conservative and only likes a single integer ???? (which may be positive, negative, or zero). To co...原创 2019-10-27 13:05:51 · 600 阅读 · 0 评论 -
The Brand New Function CodeForces - 243A(二进制,st表,dp)
Polycarpus has a sequence, consisting of n non-negative integers: a1, a2, …, an. Let’s define function f(l, r) (l, r are integer, 1 ≤ l ≤ r ≤ n) for sequence a as an operation of bitwise OR of all the...原创 2019-10-24 18:09:54 · 345 阅读 · 0 评论