自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(52)
  • 收藏
  • 关注

原创 Codeforces Round #666 (Div. 2) D. Stoned Game(博弈论)

题目链接思路:如果最大值超过其他所有值则先手赢,当石子总数为偶数时后手赢否则先手赢,因为相当于每一轮都要拿走两个。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=1e5+9;const int M=1e4+5;const double eps=1e-8;const int mod=1

2020-08-31 23:10:58 203

原创 Codeforces Round #666 (Div. 2) C. Multiples of Length

题目链接思路:如果n为1直接输出两个不改变和一个变为0即可,如果n大于1那么第一次操作就将1到n-1同时加上a[i]*(n-1)将他变成n的倍数最后再用第三次操作将所有的n个数组变成0即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=1e5+9;const int M=1e4+5;

2020-08-31 22:50:30 171

原创 Codeforces Round #666 (Div. 2) B. Power Sequence(暴力枚举)

题目链接思路:从1开始枚举c的大小再用一个循环从1跑到n枚举c的每一个次方,再求出需要操作的最小值即可,如果c的某个次方和a[i]的差超出1e15(数据范围内能够操作的最大值)那么这个c之后的c就不可能了,直接break然后输出之前求得的最小值即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const in

2020-08-31 22:34:11 173

原创 Educational Codeforces Round 94 (Rated for Div. 2) D. Zigzags

题目链接思路:遍历找相等,然后找相等的数之间的数和之后的相等数累加起来即可。代码:#include<bits/stdc++.h>#pragma GCC optimize("Ofast")#define endl '\n'#define null NULL#define ls p<<1#define rs p<<1|1#define fi first#define se second#define mp make_pair#define pb pu

2020-08-29 23:55:18 303

原创 Educational Codeforces Round 94 (Rated for Div. 2) B. RPG Protagonist(贪心)

题目链接思路:枚举每一种情况找出剩余质量最少的情况即放入的最多的情况即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=1e5+7;const int M=1e4+5;const double eps=1e-8;const int mod=1e9+7;const int inf=

2020-08-29 21:37:41 155

原创 Educational Codeforces Round 94 (Rated for Div. 2) C. Binary String Reconstruction

题目链接思路:字符串s[i]如果为0,那么w[i]两端也一定为0,标记完这些位置之后特判两端长度为x的位置是否有冲突即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=1e5+7;const int M=1e4+5;const double eps=1e-8;const int m

2020-08-29 20:28:57 164

原创 Codeforces Round #665 (Div. 2) D. Maximum Distributed Tree(dfs)

题目链接思路:dfs讨论m和n−1之间的大小关系,再计算每条边的贡献次数排序。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=2e5+7;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const in

2020-08-23 00:39:58 167

原创 Codeforces Round #665 (Div. 2) C. Mere Array(思维,gcd)

题目链接思路:所有是最小值的倍数的数都可以进行交换,其他数的位置不会发生改变,所以我们只需要看这些数排序之后与排序之前的位置是否一样即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=2e6+7;const int M=2e4+5;const double eps=1e-8;con

2020-08-23 00:34:06 166

原创 Educational Codeforces Round 93 (Rated for Div. 2) C. Good Subarrays

题目链接思路:将每一位上的数组-1,将问题转化为求区间和为0的问题,再维护一个前缀和即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=210;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;cons

2020-08-21 01:52:36 183

原创 Educational Codeforces Round 93 (Rated for Div. 2) B - Substring Removal Game

题目链接思路:分析可知双方每次操作一定是取连续1最多的区间消掉,贪心即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=210;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const int in

2020-08-21 01:47:25 170

原创 Educational Codeforces Round 93 (Rated for Div. 2) A. Bad Triangle

题目链接思路:判断两个最小值是否大于最大值即可代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=210;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const int inf=0x7fffffff;

2020-08-21 01:41:34 115

原创 Codeforces Round #664 (Div. 2) C. Boboniu and Bit Operations

题目链接思路:暴力从0开始枚举答案,如果有一个答案满足对任意一个ai均能找到一个bj,使得(a[i] & b[j]) | x) == x,输出即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=210;const int M=2e4+5;const double eps=1e

2020-08-20 01:19:53 185

原创 Codeforces Round #664 (Div. 2) B. Boboniu Plays Chess

题目链接思路:走过的方格是不能再走的,每个方格都要走一遍,输出路径。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=355;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const int inf=0

2020-08-20 01:12:28 145

原创 Codeforces Round #664 (Div. 2) A. Boboniu Likes to Color Balls

题目链接思路:想要满足题意则有:所有颜色的球的数量都是偶数且至多只有一种颜色的球的数量是奇数。所以我们只需要探讨初始情况和进行一次操作后是否满足上述条件即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=355;const int M=2e4+5;const double eps=1

2020-08-20 01:04:50 149

原创 洛谷-构造题专项训练-P5595 【XR-4】歌唱比赛

题目链接代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=2e6+7;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const int inf=0x7fffffff;const double pi=3.1

2020-08-19 01:20:44 270

原创 【杭电多校2020】第八场1003.Clockwise or Counterclockwise

题目链接思路:如果输出结果是顺时针则叉积方向向内,当结果是逆时针时叉积方向向外。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=2e6+7;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const i

2020-08-19 00:12:00 128

原创 Codeforces Global Round 10 C. Omkar and Waterslide

题目链接题意:每次操作可以使得一个非递减区间全部++,问你最少操作几次可以使得数组递增。思路:我们只需要让每一个递增的开头都大于上一个递增的结尾即可,因为我们每次操作都可以将这个递增结尾之后的所有数都++,这样不会影响后面的判断,也不会多++。所以具体操作就是遍历然后遇到递减的情况就将结果加上s[i-1]-s[i]。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(fal

2020-08-18 02:17:50 204

原创 Codeforces Global Round 10 D. Omkar and Bed Wars

题目链接题意:枕头大战,RL分别代表攻击方向,每次操作可以修改一个人的方向使得枕头大战的所有人都满足逻辑:如果只有一个人打你那么你必须打他,如果两边的人都没有打你或者是都在打你那么你打谁都行。思路:我们可以很容易的判断出三个连续的R或者是L都是不允许的,所以我们只需要将RRR或者LLL的末尾变成L或R即可,这样可以合理的利用每一次操作,需要注意的是要从每一个连续的R或L开始判断,因为是成环的,所以我们不能直接从头开始,还要注意当三个连续的R或L之后的字母不同时要将第二个R或L改变,因为这种情况改变末

2020-08-18 01:20:24 175

原创 Codeforces Global Round 10 B - Omkar and Infinity Clock

题目链接题意:每次都用数组中的最大值减去每一个值,问你k次后的数组。思路:如果最大值固定的话,每两次是一个循环,但是在数组中有负数和没有0的情况下最大值会发生改变,所以我们将数组变为减一次之后的数组,这样数组中一定有0并且没有负数,然后以两次为一个循环判断即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

2020-08-18 00:41:28 135

原创 Codeforces Global Round 10 A. Omkar and Password

题目链接思路:判断是否全部相等,如果全部相等则输出n,否则输出1.代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=2e6+7;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const int inf=

2020-08-18 00:31:25 154

原创 洛谷-P2669 金币

题目链接思路:一个循环求出金币数即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=2e6+7;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const int inf=0x7fffffff;co

2020-08-13 01:58:52 340

原创 洛谷-P2181 对角线(思维,数学)

题目链接思路:在经过一些排列组合的技巧,就可以得出代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=2e6+7;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const int inf=0x7fffff

2020-08-13 01:49:46 320

原创 【杭电多校2020】1009.Increasing and Decreasing

题目链接思路:将整个序列分成x块,每一块找一个元素出来形成的就是最长递增子序列;而递减序列正好是某一整块元素。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=2e6+7;const int M=2e4+5;const double eps=1e-8;const int mod=998

2020-08-13 01:43:31 336

原创 2020牛客暑期多校训练营(第十场)E.Game

题目链接思路:遍历,如果新遍历到的数大于之前的平均数,那么就再次平均,注意平均时向上取整。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=1e5+3;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;co

2020-08-10 23:40:03 240

原创 2020牛客暑期多校训练营(第十场)A Permutation

题目链接思路:构造,优先乘二,如果能够构造出则输出,不能就输出-1.代码:#include<bits/stdc++.h>//#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=2e6+7;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const int i

2020-08-10 20:24:17 231

原创 Codeforces Round #663 (Div. 2) C. Cyclic Permutations(组合数学)

题目链接思路:减后再增必成环,列出所有情况,然后再减去只先增一次再减一次的情况和只递增和只递减的情况即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int mod=1e9+7;const int N=1e6+5;using namespace std;int quick(int a,int

2020-08-10 01:06:24 290

原创 Codeforces Round #663 (Div. 2) B. Fix You

题目链接思路:将每一行最后一个变成D,最后一行全部变成R即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=1e5+3;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const int inf=0x

2020-08-10 00:56:51 192

原创 Codeforces Round #663 (Div. 2) A. Suborrays

题目链接思路:倒序输出n-1即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=1e5+3;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const int inf=0x7fffffff;cons

2020-08-10 00:54:06 233

原创 Codeforces Round #662 (Div. 2) D. Rarity and New Dress

题目链接思路:定义f[i][j]为以(i,j)为最下边的菱形的最大边长,那么很明显答案就是∑f[i][j]。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=1e5+3;const int M=2e4+5;const double eps=1e-8;const int mod=9982

2020-08-09 00:39:52 189 1

原创 2020牛客暑期多校训练营(第九场)A-Groundhog and 2-Power Representation

题目链接思路:这个题是对字符串的处理,并且会用到高精问题,如果用c++的代码模拟会非常非常非常非常非常麻烦,所以我们要灵活的运用python中的函数,下面请看代码(很离谱)。代码:print(eval(input().replace("(","**(")))...

2020-08-08 22:52:49 214 1

原创 【杭电多校2020】1002.Little Rabbit‘s Equation

题目链接思路:暴力模拟.代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=1e5+3;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const int inf=0x7fffffff;const dou

2020-08-08 22:24:02 166

原创 Codeforces Round #662 (Div. 2) B. Applejack and Storages(思维)

题目链接思路:记录个数超过2,4,6,8,的木板的个数,如果他们之间的逻辑满sum4>0&&sum2>2||sum6>0&&sum2>1||sum8>0||sum4>1就输出YES,否则就输出NO。代码:#include<bits/stdc++.h>//#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)

2020-08-08 01:27:17 268

原创 Codeforces Round #662 (Div. 2) A - Rainbow Dash, Fluttershy and Chess Coloring

题目链接思路:水题,输出n/2+1即可。代码:#include<bits/stdc++.h>//#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=2e5+7;const int M=2e4+5;const double eps=1e-8;const int mod=998244353;const int inf=0x7fffffff;

2020-08-08 01:24:11 931

原创 Codeforces Round #662 (Div. 2) C. Pinkie Pie Eats Patty-cakes

题目链接题意:给你一个数组,问你怎样摆放该数组中的数可以使得数组中相同数之间的距离的最小值最大。思路:记录出现次数最大的数并记录有多少个,将他们按照一个固定的排列在数组中每隔一个最大的区间出现一次,这样他们每次出现时相同的数之间的距离都是一样且最小值最大的,剩下的数肯定能填充到这些出现次数最大的数所排列过后的数组中且相同数距离一定会满足大于或等于该距离。代码:#include<bits/stdc++.h>//#define int long long#define IOS ios

2020-08-08 01:02:07 426 1

原创 【杭电多校2020】第六场1009.Divisibility

题目链接思路:判断b%x的奇偶性即可。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=2e5+7;const int M=2e4+5;const double eps=1e-8;const int mod=1e9+7;const int inf=0x7fffffff;const

2020-08-07 01:34:49 361

原创 Codeforces Round #661 (Div. 3) C.Boats CompetitionCompetition

题目链接思路:首先预处理出所有可能的两两相加得到的答案,然后去重处理,标记初始数组中每个元素出现的次数,并标记当前元素存在,然后枚举预处理后的两元素和标记元素是否存在。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=2e5+7;const int M=2e4+5;const doubl

2020-08-07 01:29:37 222

原创 Codeforces Round #661 (Div. 3) B.Gifts FixingFixing

题目链接思路:让每个位置上的数分别对该数组的最小值做差,求两个数组该位置做差的最大值。代码:#include<bits/stdc++.h>#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);const int N=2e5+7;const int M=2e4+5;const double eps=1e-8;const int mod=1e9+7;const in

2020-08-07 01:19:40 140

原创 Codeforces Round #661 (Div. 3) A - Remove Smallest

题目链接题意:给你一个数组,你可以选择任意两个差的绝对值小于等于1的数字并删除其中较小的那个,问你是否能够将该数组删除至只剩一个数。思路:标记每一个数字出现的次数,如果所有出现过的数字都是连续的,那么就输出YES,一旦有一个数字与其他数字不连续,那么就输出NO。 代码:#include<bits/stdc++.h>//#define int long long#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.ti

2020-08-06 00:31:27 336

原创 Codeforces Round #661 (Div. 3) D. Binary String To Subsequences(思维,字符串)

题目链接题意:给你一个01字符串,你能将他分为至少多少个相邻数字不同的子字符串,输出个数和每一个位置的字符属于哪个子串。思路:每次记录都从一段连续的0或1开始,a数组记录子串编号,b数组记录编号子串结尾为0还是1,对于每一段连续的0或1,都从编号为1的子串开始遍历,根据b数组判断最后一位的数字看他能否成为该编号子串的最后一位,如果可以就将a[i]变为该编号并改变b数组中该编号子串的结尾数字。代码:#include<bits/stdc++.h>//#define int long l

2020-08-06 00:10:31 339

原创 2020牛客暑期多校训练营(第八场)K.Kabaleo Lite(贪心,高精)

题目链接思路:对盈利做个前缀和然后从大往下取,每次取的时候增加的人数是当前的前缀和的最小值减去已经得到的人数。注意数据很大需要用到高精(所以我们用python,手动滑稽)。代码:t=int(input())for i in range(t): n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) mn=b[0] ans=a[0]*b[0] su

2020-08-05 21:58:30 159

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除