A. Inna and Choose Options time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There always is something to choose from! And now, instead of "Noughts and Crosses", Inna choose a very unusu…
B. Inna and New Matrix of Candies time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Inna likes sweets and a game called the "Candy Matrix". Today, she came up with the new game "Can…
A. Inna and Choose Options time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There always is something to choose from! And now, instead of "Noughts and Crosses", Inna choose a very unusu…
A. Inna and Choose Options time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There always is something to choose from! And now, instead of "Noughts and Crosses", Inna choose a very unusu…
A. Inna and Choose Options time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There always is something to choose from! And now, instead of "Noughts and Crosses", Inna choose a very unusu…
B. Inna and New Matrix of Candies time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Inna likes sweets and a game called the "Candy Matrix". Today, she came up with the new game "Can…
B. Inna and New Matrix of Candies time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Inna likes sweets and a game called the "Candy Matrix". Today, she came up with the new game "Can…
题目链接:http://codeforces.com/contest/979/problem/D 参考大神博客:https://www.cnblogs.com/kickit/p/9046953.html: 解题心得: 题目给了你很多条件,具体起来就是输入三个数x,k,s,在数列中找到一个数num,要求:1. GCD(x, num)%k == 0: 2. x + num <= s:3. num异或x最大 刚开始一看数据量这么大,条件这么多怎么搞.其实前面两个条件是用来剪枝的.首先可以开很多个set…
题目链接:http://codeforces.com/contest/979/problem/B 解题心得: 这个题题意就是三个人玩游戏,每个人都有一个相同长度的字符串,一共有n轮游戏,每一轮三个人必须改变自己字符串中的一个字母,最后得分就是字符串中出现字符最多的字母的次数. 感觉这个题从题目描述到做法都像一个脑筋急转弯.主要明白一点,如果一个数要变回自己要怎么变.自己->其他->自己.自己->其他->其他->自己,推几个特例很容易就出来了. #include <bit…
F. Ivan and Burgers 题目链接:https://codeforces.com/contest/1100/problem/F 题意: 给出n个数,然后有多个询问,每次回答询问所给出的区间的异或和最大值. 题解: 考虑离线做法,先把所有的询问区间按照右端点进行排序,然后从1开始逐个将ai插入,插入线性基的同时记录一下位置,最后扫一下,看看哪些的位置是不小于li的即可加入答案. 这种做法在时间复杂度上面是可行的,但是需要注意的是,如果在i这个位置插入最高位为x的线性基,同时在j这个位…
C. Enlarge GCD 题目链接:https://codeforces.com/contest/1047/problem/C 题意: 给出n个数,然后你可以移除一些数.现在要求你移除最少的数,让剩下数的gcd变大. 题解: 首先可以先让所有数都除以他们的gcd,让他们互质,好让问题简单化. 由唯一分解定理,题目中的问题可以转化为:找出最多数都共有的质因子,假设其数目为mx,答案就是n-mx. 上面的想法也是基于贪心,具体做法还是有点技巧,就是在筛素数的时候就进行判断,具体见代码吧: #in…
D. Nature Reserve 题目链接:https://codeforces.com/contest/1059/problem/D 题意: 在二维坐标平面上给出n个数的点,现在要求一个圆,能够容纳所有的点,并且与x轴相切的最小半径为多少. 题解: 容易知道圆的纵坐标的绝对值等于其半径,并且半径越大,容纳圆的可能性越大,那么就考虑二分其半径,这样y0值也确定了. 但x值不是很好求.这里我们找到y=y0的那一条线,然后根据半径以及y0,yi值,可以求出当x0在哪一段时,能够包含(xi,yi)这…
题目连接:http://codeforces.com/contest/979/problem/C 解题心得: 题意就是给你n个点,在点集中间有n-1条边(无重边),在行走的时候不能从x点走到y点,问你任意两点一共有多少种走法,u到v和v到u为不同的走法. 首先要明白的是n个点n-1条边就是一棵树.而在树中任意两点有且仅有一条路径.这样就简单了,先从x点dfs到y点,将唯一的一条路径标记上就将树x点和y点形成的子树分开了.然后不走标记的点就可以再次dfs的得到x点子树上的点数sumx,以及y点子树…
D. MADMAX time limit per test1 second memory limit per test256 megabytes Problem Description As we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actual game just to prove that…
B. Radio Station time limit per test2 seconds memory limit per test256 megabytes Problem Dsecription As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx conf…
A. DZY Loves Chessboard time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves chessboard, and he enjoys playing with it. He has a chessboard of n rows and m columns. Some cells of the c…
C. DZY Loves Sequences time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY has a sequence a, consisting of n integers. We'll call a sequence ai, ai + 1, ..., aj (1 ≤ i ≤ j ≤ n) a subsegment…
B. DZY Loves Chemistry time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves chemistry, and he enjoys mixing chemicals. DZY has n chemicals, and m pairs of them will react. He wants to…
Inna and Choose Options Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 400A64-bit integer IO format: %I64d      Java class name: (Any)   There always is something to choose from! And now, instead of…
Codeforces Round #734 (Div. 3) 20210920.网址:https://codeforces.com/contest/1551. 编程细节:下标定义不要一会[1,n]一会[0,n)啊- A 用价值为1的硬币a枚+价值为2的硬币b枚,买价值为n的东西,希望ab之差的绝对值尽量小.大水题. B1 给我们一个字符串s,用红色和绿色给s上色,规则如下: 一个字母或者不上色,或者被涂成一种颜色,即不能又红又绿. 被涂成一种颜色的所有字母,必须两两不相同. 红色字母数量=绿色字…
Codeforces Round #739 (Div. 3) 20210907.网址:https://codeforces.com/contest/1560. --(叹). A 不希望出现带"3"的数和3的倍数,把剩下的数从小到大排,问第k个是多少.数据范围很小,因此是大水题. B 偶数个人围成圈,按顺时针给每个人编号,不知道总共多少人.问题是,如果知道a和b面对面,那么c和谁面对面.简单的讨论,注意围不成圈的情况(如1和3面对面,问99对面是谁). C 用一种方式(详见题目,很容易的…
Codeforces Round #731 (Div. 3) 20210803.网址:https://codeforces.com/contest/1547. 感觉这次犯的低级错误有亿点多-- A 一个大水题. B 给我一个字符串,让我判断它是否alphabetical.一个alphabetical字符串可以这样生成:首先放一个a,然后在左边/右边放一个b,然后再在新字符串的左边/右边放一个c--也就是,新串=最新字母.append(旧串),或新串=旧串.append(最新字母). 所以我们维护…
Codeforces Round #724 (Div. 2) 20210713.网址:https://codeforces.com/contest/1536. div2明显比div3难多了啊-只做了前4题,然后看了看第五题的题解.第五题给我一种--比较难想的感觉. 可能以后还是会做div3,或者只做div2的前几题.感觉div2的题目可能并不是我这个水平应该写的--下一步也可能会根据难度分类找题刷.还有就是学DL,喊了一周半,什么都没看,接下来要看了--我会继续加油的. 我会继续加油的. A 定…
Codeforces Round #725 (Div. 3) 20210704.网址:https://codeforces.com/contest/1538. 感觉这个比上一个要难. A 有一个n个数的数组,我们每次只能拿走最左边/最右边的数.想把最大/最小的数都拿走,最少拿几次. 读入的时候就记录下来最大最小的位置,设左边位置为x,右边位置为y.要不[从左边拿直到拿走y],要不[从右边拿直到拿走x],要不[从左边拿直到x+从右边拿直到y],取个min就可以了. B 大水题,首先判能不能整除(平…
Codeforces Round #719 (Div. 3) 20210703.网址:https://codeforces.com/contest/1520. 没错,我是个做div3的蒟蒻-- A 大水题. B 所有数位都一样的数是[ordinary数](如1,22,333).给一个数n,问小于等于n的[ordinary数]有多少. 直接用一个数组记录[ordinary数],然后以n为key对数组进行二分搜索,返回的下标就是答案.二分搜索:STL的lower/upper_bound. 怎么得到这…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输出”#Color”,如果只有”G”,”B”,”W”就输出”#Black&White”. #include <cstdio> #include <cstring> using namespace std; const int maxn = 200; const int INF =…
 cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....       其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…
Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Victor adores the sets theory. Let us remind you that a set is a group of…