cheeserish
cheeserish
全部文章
分类
题解(62)
归档
标签
去牛客网
登录
/
注册
cheeserish的博客
TA的专栏
3篇文章
0人订阅
牛客多校练习
2篇文章
785人学习
每日打卡
1篇文章
719人学习
全部文章
(共62篇)
不平衡数组
表示,dp的魅力;只要知道这题用dp做,就差不多了;怎么想到dp?一方面做题多,另一方面排除法,别的都不行。这道题求最小值,最值一般dp。二分,贪心。最后选dp;dp[][0/1]表示,到达i的时候,前i-1个数满足题意,第i个数是否需要+/-1;需要判断a[i]与a[i-1]的关系; #inclu...
2020-06-06
1
646
夹娃娃
区间求和,前缀和。 #include<bits/stdc++.h> using namespace std; int w[1000010],n,sum[10000010]; int main() { int k,ans=0; cin>>n>>k; ...
2020-06-06
0
554
走出迷宫
就是搜索模板; #include<bits/stdc++.h> using namespace std; const int maxn=510; int s,t,n,m; int mp[maxn][maxn],vis[maxn][maxn]; int d[4][2]={{1,0},{0,...
2020-06-04
0
670
切长条
贪心~ #include<bits/stdc++.h> using namespace std; struct node{ int s,f; }nod[33000]; bool comp(node x,node y) { if(x.f<y.f) return...
2020-06-01
0
591
值周
区间上修改,操作简单,就考虑下差分; #include<bits/stdc++.h> #include<cstdio> using namespace std; #define int long long const int maxn=1e8+6; int ans,a[max...
2020-05-31
0
586
第k小数
表示我就看到了桶排序; #include<bits/stdc++.h> using namespace std; inline int read(){ int x = 0, f = 1; char ch = getchar(); while(ch < '0' ||...
2020-05-31
0
623
点对最大值
bug真是个神奇的东西;看这道题,求最值,也没什么数据结构可言,就考虑dp;树形dp一般只有两种形式;f[i]表示以i为根的子树,到达i结点的最大值(这里没包含i) #include<bits/stdc++.h> using namespace std; const int maxn=1...
2020-05-31
0
797
[JSOI2007]建筑抢修
get到了;可以后悔的贪心;有点像回溯;类似安排会场问题,使得会场数最少;因为每个维修时间有限,所以按照截止时间排序;(直观感受就是t2大的尽量排在后面完成)之后就是在符合要求的条件下选择更小t1进行(这样能尽可能安排); #include<bits/stdc++.h> using na...
2020-05-29
0
663
简单瞎搞题
看题目,没找到什么规律;而且每个区间正好可以看成一个空间,分别从每个空间取出一个物品,满足题意;所以分组背包;dp[i][j]到第i个空间时,值是否可达到j;显然这样会超内存;对于每个dp值,只存在0,1;所以考虑bitset优化;到达第i个位置dp [ i ] = dp [ i ] | ( dp ...
2020-05-27
0
614
二分
唉,被题目坑了。还以为题目好心提醒是二分。比赛时一直找二分条件,mmm一直找不出。(我真是个憨憨)最后几分钟,突然搞明白,不用二分。:-(;看题目,首先暴力枚举,怎么暴力??对于每个int型范围内的整数,都有可能。那么枚举每个数,判断最多符合条件的。这是最初的思路,当然暴力过不了;想怎么优化,我们想...
2020-05-26
12
1326
首页
上一页
1
2
3
4
5
6
7
下一页
末页