自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(48)
  • 问答 (3)
  • 收藏
  • 关注

原创 王爽 汇编课程设计1

【代码】王爽 汇编课程设计1。

2022-11-22 22:23:07 130 1

原创 记录美好生活 艹

Red Black Tree 磨磨蹭蹭地写虚树,结果半天没出来。大佬说 二分 求公共节点的lca,一下就出来了  二分就是取那些要变更的点的lca 然后判断这样log^2,好像也可以排序差分区间和弄到log,虚树就是暴力枚举然后换根dp,没弄好debug一下午。虚树// 基本没啥用就 两个函数是要想的,其他都是虚树构造必须 虚树构造相关操作void dfs(int u, int f);int lca(int u, int v);LL build(int n); 需要思考的操作LL df

2022-03-27 15:21:19 757 2

原创 dpdpdp

D. Beautiful numbers  代码  第一次把18位LL变成11位int+7位LL存,但是还是T了,结果发现倍数只有48种,那就枚举了,麻了麻了。LL dp[18][50][2520]; // = t*2520 + x = (t*f + x/z)*z + x%z;// dp[i][j][k] = i位 0-9=j %2520=k 的情况数. int in[100], pos[N];vector<int> G;int lcm(int a, int b)

2022-03-10 16:53:36 279

原创 【无标题】

H. Crystalfly   代码t<=3说明只能得到一个子树或者另一颗子树的根节点,然后分类成三种树LL dp[3][N];int a[N], t[N];vector<int> v[N];void dfs(int u, int fa){ int ma = 0; PII c[3] = {{1e18, 0}, {1e18, 0}}; // 求dp[2][x] - for(auto x : v[u]) { if(x == fa) continue; d

2022-02-27 16:10:29 293

原创 【无标题】

牛客练习赛95 gcd 未补牛客练习赛95 Painting Fences 未补E. Middle Duplication 未补

2022-02-09 16:29:08 364

原创 Codeforces Round #764 (Div. 3)

A. Plus One on the SubsetB. Make APC. Division by Two and PermutationD. Palindromes ColoringE. Masha-forgetfulF. Interacdive ProblemG. MinOr Tree 就是最小值逐步增加到最大值的过程。int main(){ int t; scanf("%d", &t); for(int _ = 1;_ <= t;_ ++) { int

2022-01-21 13:08:29 585

原创 Codeforces Round #766 (Div. 2)

D. Not AddingE. Not Escaping 直接枚举就行了,原本还想的是素倍数,但是素倍数也不行。bool dis[N];int main(){ int n, x; scanf("%d", &n); int ans = -n; while(n --)scanf("%d", &x), dis[x] = 1; for(int i = 1;i <= 1e6;i ++) { int t = 0; for(int j = i;j <=

2022-01-18 21:15:47 505

原创 Codeforces Round #762 (Div. 3)

E. MEX and IncrementsF. Let’s Play the Hat?G. Unusual MinesweeperH. Permutation and Queries 用个优先队列模拟。map<int,int>ma;priority_queue<int> q;int main(){ int t; scanf("%d", &t); while(t --) { int n; scanf("

2022-01-17 22:22:38 304

原创 Educational Codeforces Round 119 (Rated for Div. 2)

D. Exact ChangeE. Replace the NumbersG. Subsequences Galore 因为1和2的数量最大值不是很多,多了的话可以用3代替,那么枚举1和2的数量然后二分3的数量int a[110], n;bitset<10> bit;bool ch(int x){ for(int i = 1;i <= n;i ++) { int num = a[i]; x*3 >= a[i] ? num %= 3 : num -= x*

2022-01-13 21:24:41 195

原创 Codeforces Round #760 (Div. 3)

E. Singers’ TourF. ReverseG. Trader Problem  推推式子就行了。int a[N];int main() { int t; scanf("%d", &t); while(t --) { int n; LL sum = 0; scanf("%d", &n); for(int i = 1;i <= n;i ++) scanf("%d", a+i), sum += a[i]; a[0] = a[n]; i

2022-01-12 11:29:00 297 3

原创 AtCoder Beginner Contest 234

A - Weird FunctionB - Longest SegmentC - Happy New Year!D - Prefix K-th MaxE - Arithmetic NumberF - ReorderingG - Divide a Sequence 写个函数int f(int x){return x*x+2*x+3;}int main() { int t; scanf("%d", &t); cout<<f(f(f(t)+t)+f(f(t)))

2022-01-10 14:04:42 356

原创 AtCoder Beginner Contest 230

A - AtCoder Quiz 3B - Triple Metre C - X drawing 暂无D - Destroyer Takahashi 暂无E - Fraction Floor SumF - PredilectionG - GCD PermutationH - Bullion暂无  int t; scanf("%d", &t); t += t>=42; printf("AGC%03d", t);  string t = "", c; for

2022-01-01 15:22:13 389

原创 Codeforces Round #759 (Div. 2, based on Technocup 2022 Elimination Round 3)

感觉E思路明确只用了stl+树状数组,F线段树复合修改,为什么都是2400。A. Life of a FlowerB. Array EversionC. Minimize DistanceE. Frequency QueriesF. Non-equal Neighbours F : 首先 dp[i][j]=sum[dp[i−1]]−dp[i−1][j]dp[i][j] = sum[dp[i-1]] - dp[i-1][j]dp[i][j]=sum[dp[i−1]]−dp[i−1][j],但

2021-12-18 18:33:01 369

原创 P1232 [NOI2013] 树的计数

…调半天别的东西写错了,心力交瘁。思路还是不会。。具体就是二分,没想到,然后再贪心。一直没整明白一个数它要往别的树走的条件是什么,日后研究。#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <set> #include <vector> #include <queue>#define m

2021-12-07 21:04:33 241 1

原创 Educational Codeforces Round 118 (Rated for Div. 2)

A - Long ComparisonB - Absent RemainderC - Poisoned Dagger D - MEX SequencesE - Crazy Robot  拿字符串比较#include <iostream>#include <algorithm>#include <cstring>#include <vector>#include <cmath>#include <stack>#i

2021-12-02 12:54:26 409

原创 Codeforces Round #757 (Div. 2)

A. Divan and a StoreB. Divan and a New ProjectC. Divan and bitwise operationsD1. Divan and Kostomuksha (easy version)D2. Divan and Kostomuksha (hard version)E. Divan and a Cottage  排序贪心#include <iostream>#include <algorithm>#include

2021-11-30 21:10:37 689

原创 Educational Codeforces Round 117 (Rated for Div. 2)

A. DistanceB. Special PermutationC. Chat BanD.X-Magic PairE. MessagesF:没看F,好难的样子G. Max Sum Array#include <iostream>#include <algorithm>#include <cstring>#include <vector>#include <cmath>#include <stack>#inc

2021-11-30 17:53:44 188

原创 NEC Programming Contest 2021 (AtCoder Beginner Contest 229)

终于开始补提了B - Hard Calculation#include <iostream>#include <algorithm>#include <cstring>#include <vector>#include <cmath>#include <stack>#include <map>#define mid (l+r>>1)#define lowbit(x) (x&-x)us

2021-11-29 21:12:22 570

原创 虚树简单例题

P2495 [SDOI2011]消耗战代码有的虚树建立好像把一些点没建,他们不用判断是否是关键点;il void push(int x){ if(t == 1) {s[++ t] = x;return;} int l = lca(x, s[t]); if(l == s[t]) return; //这句话我没看懂,因该就是这,脑子好乱; while(t > 1 && dfn[s[t - 1]] >= dfn[l]) v[s[t - 1]].push_back(s[

2021-11-18 20:00:43 88

原创 201512-5 矩阵

只会暴力,答案没看懂,呜呜呜。乘的时候还乱七八糟的。#include <iostream>#include <algorithm>#include <cstring>#include <vector>#include <queue>#include <bitset>#define ls (u<<1)#define rs (u<<1|1)#define mid (l+r>>1)u

2021-11-12 18:46:37 404

原创 201612-5 卡牌游戏

**根据题目样例解释得到每种卡牌拥有状态之间的关系,然后转换成等式,高斯消元是2^(3n) **80分超时代码:#include <iostream>#include <algorithm>#include <cstring>#include <vector>#include <queue>#define ls (u<<1)#define rs (u<<1|1)#define mid (l+r>&

2021-11-11 20:57:22 242

原创 201403-5 任务调度

哇,csp历年认证题解(一本书)真厉害。#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>using namespace std;typedef long long LL;typedef pair<int,int> PII;const int N=1e5+10,mod= 998244353;// 首先 对于方案二和方案四都不能和其他方案

2021-11-09 19:22:05 174

原创 201609-5 祭坛

超时暴力60分#include <iostream>#include <algorithm>#include <cstring>#include <sstream>using namespace std;typedef long long LL;const int N = 5e5 + 4, mod = 1e9 + 7;vector<int> v[N];int y[N], sizy, x[N], sizx, numx[N], a[

2021-11-08 22:29:24 111

原创 201409-5 拼图

七十分超时代码,具体思路可以仿照acwing蒙德里安的梦想就是枚举第i层放 a ,第i-1层放b的合法方案其中b和a都是同一块; #include <iostream>#include <algorithm>#include <cstring>#include <sstream>using namespace std;typedef long long LL;const int N = 5e5 + 4, mod = 1e9 + 7, M = 1

2021-11-07 21:22:01 89

原创 Transformation HDU - 4578

思路:三种改变的顺序,先变 后乘 再 加。#include <iostream>#include <algorithm>#include <cstring>#include <sstream>using namespace std;typedef long long LL;const int N = 5e5 + 4, mod = 1e4 + 7;int n, m;struct seg{ int sum[4], lazy[4];}tr[

2021-11-06 19:39:57 62

原创 线段树+树状数组

感觉这东西就是每棵线段树管的区间变了,以前学的时候线段树总是只管一个点或者管(1-i)这些点,但是这东西如果加上树状数组的思想,每棵线段树管( i-(i&-i)+1 ~ i )这些区间,那么动态修改单点就不用nlog修改只用改这个点在那log棵线段树改log*log次;查询的话变慢了点,之前的 log变成了 log * log;精品博客 讲的真的很好 感谢大佬:博客园 TaylorSwift13 的 树状数组套权值线段树动态逆序对Dynamic Rankings#include &

2021-11-05 12:39:00 143

原创 并查集虚拟节点

​HDU 3234 Exclusive-ORAC代码简洁版AC代码不好看的Almost Union-Find UVA - 11987AC代码#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>#include <sstream>using namespace std;typedef long long ll;const int

2021-11-02 21:05:14 191

原创 F - Parenthesis Checking

1 . ( - > 1 , ) - > -1; 先想前缀和,求出l,r中的最小值,如果最小值小于l-1的前缀和,那么说明有某个点的 ) 大于 ( 数量 不满足条件; 用线段树优化区间修改和区间查询;2 . 队友说,可以直接算一个区间经过化简之后形成的) ( 中的( 数量和 )的数量 ,可以区间更新;一 :#include<iostream>#include<cstdio>#include&lt...

2021-10-19 21:44:00 164

原创 线段树动态开点 - - - > 线段树合并

逆序对代码

2021-10-08 22:58:10 97

原创 1592E - Скучающий Бакри

首先把那式子转换成长度为偶数并且二进制有一段连续的一,大于这位的数量都是偶数如果长度为奇数那么如果 and 是1,xor 一定是1;and 是0,xor可能是1;所以长度为奇数一定不可以。那么长度为偶数的话,对二进制的每位来说,and = 0,xor = 1 ; and = 1/0,xor=0;两个数的大小是由最高不同位确定的,那么假设 二进制第 i位不同,那么上面的要相同则 只有xor = and 0 ,所以有偶数个1 和第 i 位都是 1 ;二进制有一段连续的一,大于这位的数...

2021-10-04 17:05:04 68

原创 树上启发式合并 简单例题

U41492 树上数颜色#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <set> #include <vector> #include <queue>using namespace std;typedef long long LL;typedef pair<int,int&gt

2021-09-26 19:40:54 86

原创 2021-09-211547G - How Many Paths?

#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <set> using namespace std;typedef long long ll;const int N=4e5+10,M=1e6+10,mod=998244353;int h[N],hs[N],e[M],ne[M],idx=0; // h 原图 .

2021-09-21 21:34:35 69

原创 acwing.1174 受欢迎的牛 tarjan求有向图强连通分量

#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <stack>#include <map>#include <cmath> #include <vector>using namespace std;typedef long long ll;typedef pair<in.

2021-09-15 20:44:21 73

原创 配对游戏

#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <stack>#include <map>#include <cmath> #include <vector>using namespace std;typedef long long ll;typedef pair<in.

2021-09-14 18:11:27 711

原创 201912-3 化学方程式

他这个好像之和大写字母有关系;小写字母跟着前面的的大写字母;+和=代表要处理了;()代表要乘了;#include<iostream>#include<cstdio>#include<algorithm>#include<cstring> #include<vector>#include<set>#include<stack>using namespace std;typedef long l

2021-09-14 09:10:37 61

原创 牛客 黑白树

#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <stack>#include <queue>#include <cmath> #include <vector>using namespace std;typedef long long ll;typedef pair<.

2021-09-08 18:19:59 69

原创 Building Fire Stations

题目链接首先找到树的直径,直径左端点是a,直径右端点是b,中间的点是mid(偶数的情况下mid可以看做两个),两点因该是左右分布;假设两点都不在直径上,那么移到直径上的话距离更短;设直径上左边的消防站是x,右边的消防站是y;如果直径上的两个点不对称的话,那个距离就肯定大于等于a到x,b到y;所以可以让过度的点(已经满足要求)一点,那样更优而且并不影响;直径上的点更靠近中间的话,就更符合要求但是距离也会变大,就是单调的图,由不行变成行;现在就是要求行的分界线;#include&l

2021-08-18 21:36:26 101

原创 K - Keen On Everything But Triangle

#include<cstdio>#include<iostream>#include<cstring>#include<vector>#include<queue>#include<algorithm>#include<cmath>using namespace std;typedef long long ll;const int N=3e5+10,mod=1e6+3;int a[N],b[N],id[.

2021-08-18 17:06:20 52

原创 D. Ezzat and Grid

#include<cstdio>#include<iostream>#include<cstring>#include<vector>#include<queue>#include<algorithm>#include<cmath>using namespace std;typedef long long ll;const int N=3e5+10,mod=998244353;vector<pa.

2021-08-16 19:46:58 114

原创 Eyjafjalla

区间查询有关比大小的数目,主席树感觉学线段树的时候不用x<<1,x<<1|1去建一次树那样就容易理解多了;#include<cstdio>#include<iostream>#include<cstring>#include<vector>#include<queue>#include<algorithm>#include<cmath>using namespace std;

2021-08-15 18:16:08 98

空空如也

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

TA关注的人

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