10 2018 档案
摘要:树剖裸题 1 // luogu-judger-enable-o2 2 #include<bits/stdc++.h> 3 using namespace std; 4 #define ll long long 5 const int N=3e5+777; 6 vector<int> v[N],w[N
阅读全文
摘要:B 假设已知a[i],b[i],t[i],可以确定t[i+1]. 枚举t[1]={0,1,2,3}看是否有可行解
阅读全文
摘要:思维,sum[i]=sum[i-1]+t[i]; 将第i添加入的雪与之前加入的雪统一起来。 stl priority_queue 模板(ps:之前优先队列开int炸了。。) 定义 重载运算符 /// 记得写bool 基本操作
阅读全文
摘要:切比雪夫距离转曼哈顿距离 (x,y)->((x+y)/2,(x-y)/2) 前缀和优化
阅读全文
摘要:xx 树的直径 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define ll long long 4 struct re{ 5 ll v; 6 ll nex; 7 ll w; 8 }; 9 const ll N=1e6; 10 re ed
阅读全文
摘要:1.反码补码ok 2.链表 3.字符串 4.前缀中缀后缀ok 5.归并排序ok 6.快速排序 nth_element() 7.循环队列 8.192.168.0.3 9.np 1 无向图存在欧拉回路的充要条件 一个无向图存在欧拉回路,当且仅当该图所有顶点度数都为偶数,且该图是连通图。 $2
阅读全文
摘要:t1 二项式定理+杨辉三角水过去 t2 pts30:枚举物品的重量;O(n*m*max(w[i])) 交了写挂10分? 正解 :前缀和套路+二分答案。 第一次写的时候单调性没有考虑清楚。 pts?:改二分答案为穷举;期望o(max(w[i])*max(n,m)); 爆0???memset 1e6的数
阅读全文
摘要:dp[s][a]已询问{s}有{a}特征,还需要查询几次才能明确是哪一样物品。 答案为dp[0][0]. #include<bits/stdc++.h> using namespace std; #define ll long long ll n,m; short dp[2050][2050]; l
阅读全文
摘要:问题 区间[l,r]出现偶数次数的数字的异或和 a[i]<1e9;l,r,q<1e6; 由 x xor x=0;a xor 0=a; 1.区间直接异或和 为出现奇数次的数异或和 2.区间内所有不同数的异或和 1异或2就是出现偶数次数的异或和。 1 #include<bits/stdc++.h> 2
阅读全文
摘要:提醒老师报NOI LINUX 模拟题泛做 codeforce1042C HDU5353 https://www.luogu.org/blog/darkflames/noi-linux windows 1 int t=1000; 2 while(t--) 3 { 4 system("maker p.i
阅读全文
摘要:跑floyd 表示在k前,i,j间的最短路 #include<map> #include<cmath> #include<ctime> #include<queue> #include<cstdio> #include<vector> #include<bitset> #include<cstrin
阅读全文
摘要:dp[l][r][0/1]已排好l,r;最后一个排的是l/r; 转移:
阅读全文
摘要:#include<bits/stdc++.h>using namespace std;#define ll long longll sum[500000],az[500000];ll n,p,ans;ll ql,qr,v,hh;void pushdown(ll o){ if(az[o]!=0){ a
阅读全文
摘要:1.[BZOJ1025]思维+dp pi为质数; 求sum(pi)<=N不同lcm的数量。 pi*pj(i<j)—>lcm(pi,pi*pj)=pi*pj 不如只取Pj, f[cc][sum]用cc个质数,和为sum的方案数 f[cc][sum]=sigama(f[cc-1][sum-pj^x])
阅读全文