摘要: 关键是k<=n; 考虑最坏情况,逆序 每次挑最大值,只移动一次扔到尾巴 多模拟几个数字,发现任意一种情况都可以这样解决 #include<bits/stdc++.h> using namespace std; typedef long long ll; ll n,a[100],cnt,ans[100 阅读全文
posted @ 2021-09-30 09:26 curx 阅读(155) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/1579/problem/E1 算法的本质思路是贪心 第一点看到n特别大,又是求最优解问题,多手玩几个数字就好了 在实现上要会写小根堆, 赛场上a了,赛后被卡在test 14 #include<bits/stdc++.h> using n 阅读全文
posted @ 2021-09-30 09:22 curx 阅读(283) 评论(0) 推荐(0)
摘要: 永远也不退役,无论有多少人比我强都不退役,关我屁事 活着就不退役 我永远肝 #include<bits/stdc++.h> using namespace std; const int maxn=1e6; int cnt=0,n,m,s,dis[maxn],vis[maxn],head[maxn]; 阅读全文
posted @ 2021-09-30 09:17 curx 阅读(61) 评论(0) 推荐(0)
摘要: 在做https://codeforces.com/contest/1579/problem/D时 思路出了不会写 赛后看b站解说 你就开个优先队列每次取两个top出来--; 我: 这就去学。 struct node{ int id,val; bool operator < (const node t 阅读全文
posted @ 2021-09-30 00:07 curx 阅读(108) 评论(0) 推荐(0)
摘要: 是getsum(a[i]-1) 不是getsum(i-1); 20210920 #include<bits/stdc++.h> using namespace std; const int maxn=1e5; int a[maxn],n,c[maxn],ans[maxn]; int lowbit(i 阅读全文
posted @ 2021-09-29 21:57 curx 阅读(59) 评论(0) 推荐(0)
摘要: 跑两遍dij 其中第二遍把所有边反向 问题在于如何把各类边和dis清干净 2021 09 29 待补 2021 10 05 #include <iostream> #include <math.h> #include <string.h> #include <vector> #include <ma 阅读全文
posted @ 2021-09-29 19:08 curx 阅读(46) 评论(0) 推荐(0)
摘要: //可是spfa会被卡得很惨很惨wa//待补充dij#include <iostream> #include <math.h> #include <string.h> #include <vector> #include <map> #include <queue> #include <stdio. 阅读全文
posted @ 2021-09-29 18:00 curx 阅读(36) 评论(0) 推荐(0)
摘要: 我的思路是二分出答案,然后跑n3的弗洛伊德判断当以这个答案作为最大值时,能不能到目的 但是t了,一想, 200*200*200=800,0000; 极限情况是32 32个八百万,爆炸了。 错误代码: (t了但是理论上可行 #include <iostream> #include <math.h> # 阅读全文
posted @ 2021-09-29 17:59 curx 阅读(30) 评论(0) 推荐(0)
摘要: #如果update写成了边界为l==r,那跟没建树有什么区别 #没写pushdown的话就直接回溯sum,会出大锅,会存在大区间的ans和lazy都改了,但小区间的还是保持原样 当这个区间又被查询的时候,会出现大区间=小区间+小区间(tree i=tree i*2+tree i*2+1),相当于没改 阅读全文
posted @ 2021-09-26 10:12 curx 阅读(53) 评论(0) 推荐(0)
摘要: #我大爷的读入被卡了 #对于ADD,END什么的处理,开个char,然后判断s[0],嘛 自己调的代码~ #include <iostream> #include <math.h> #include <string.h> #include <vector> #include <map> #inclu 阅读全文
posted @ 2021-09-25 11:30 curx 阅读(35) 评论(0) 推荐(0)