首页 > TAG信息列表 > Ivan

Ivan and Powers of Two

题意: 给出$n$个数$a$$1$$,a$$2$$,...,a$$n$$.$按升序排序,表示$2$$a$$1$$,2$$a$$2$$,...,2$$a$$n$, 设一个序列$b$$1$$,b$$2$$,...,b$$m$,使$2$$a$$1$$+2$$a$$2$$+...+2$$a$$n$$+2$$b$$1$$+2$$b$$2$$+...+2$$b$$m$$=2$$k$$-1.$求$m$的最小值$($其中$k$为非负整数$)$. 输入格式: 共两

CF1100F Ivan and Burgers

给定\(n\)和\(a_{1\cdots n}\),有\(q\)个询问,每个询问要求区间\([l,r]\)内选出任意个数的异或最大值。\((n,q\leq 5\times 10^5, a_i\leq 10^6)\) 不知道怎么就想到了分块。先按\(\sqrt n\)分块,预处理出\(f[l][r]\)表示第\(l\)个块到第\(r\)个块所有数的线性基,这个可以\(\mathcal

CF1100F Ivan and Burgers

链接 有点像 P1972 [SDOI2009]HH的项链? 将区间按 \(r\) 排序,对于在线性基中的每个元素,其在序列中的位置肯定是尽量靠右,所以插入时如果插入值与线性基在某一位上都为 \(1\),则比较其在序列中的位置,若插入值靠右则交换,继续插入。 #include<bits/stdc++.h> #define IL inline #define

A. Ivan the Fool and the Probability Theory

Recently Ivan the Fool decided to become smarter and study the probability theory. He thinks that he understands the subject fairly well, and so he began to behave like he already got PhD in that area. To prove his skills, Ivan decided to demonstrate hi

A. Ivan the Fool and the Probability Theory

https://codeforces.com/contest/1239/problem/A discription given a \(n*m\) field in which every grid can be painted black and white. count the number of different situation, where every grid has at most one adjacent grid that shares the same color. break

CF1239A. Ivan the Fool and the Probability Theory

题目:伊凡傻子与概率论 一看我还以为是真·概率论…… 一句话题意: 有一个$n \times m$网格图,每个格可以被涂成白色或黑色,现在定义 ‘随机图’ :每个点的上下左右最多只有一个格与其颜色相同,请计算其数量,对$10^9+7$取模。 题解: 第一次见$Fibonacci$计数。 首先我们思考一下,染色的情

C - Ivan the Fool and the Probability Theory---div2

题目连接:https://codeforces.com/contest/1248/problem/C 思路: 注意上下两排的关系,如果说上面那一排有两个方格连续,那么他相邻的两排必定和他相反,如果说当前这一排没有连续的两个方格,那么它相邻的两排必定和它相同,因此,当第一排或者第一列确定好了,他下面的也就确定好了。 因此我们

Educational Codeforces Round 74 (Rated for Div. 2) B. Kill 'Em All

链接: https://codeforces.com/contest/1238/problem/B 题意: Ivan plays an old action game called Heretic. He's stuck on one of the final levels of this game, so he needs some help with killing the monsters. The main part of the level is a large corridor (s

CodeForces 1100F Ivan and Burgers

CodeForces题面 Time limit 3000 ms Memory limit 262144 kB Source Codeforces Round #532 (Div. 2) Tags data structures divide and conquer greedy math *2600 Editorial Announcement #1 (en) Announcement #2 (ru) Tutorial #1 (en) Tutorial #2 (ru) Tutorial #3 (en

CF1100F Ivan and Burgers

CF1100F Ivan and Burgers 静态区间,选取任意个数使得它们的异或和最大 \(n,\ m\leq5\times10^5,\ a_i\in[0,\ 10^6]\) lxl ST表,线性基 如果暴力维护线性基,线段树时间复杂度为 \(O(n\log^2n)-O(\log^3n)\) 由于重复元素对答案没有影响,于是可以用ST表维护,时间复杂度为 \(O(n\log^3

CodeForces-1140A-Detective Book

题目: Description: Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The ii-th page contains some mystery that will be explained on page aiai (ai

Codeforces Round #532 (Div. 2)-F. Ivan and Burgers-线性基

Codeforces Round #532 (Div. 2)-F. Ivan and Burgers-线性基 【Description】 Ivan loves burgers and spending money. There are burger joints on the street where Ivan lives. Ivan has friends, and the -th friend suggested to meet at the joint li and walk to