- 博客(20)
- 收藏
- 关注
原创 [luogu] P1048 采药
题源:https://www.luogu.org/problem/P1048#include <bits/stdc++.h>#define numm ch - 48#define pd putchar(' ')#define pn putchar('\n')#define pb push_back#define fi first#define se...
2019-11-15 21:23:12 139
原创 P1880 [NOI1995]石子合并
题源:https://www.luogu.org/problem/P1880#include <bits/stdc++.h>#define numm ch - 48#define pd putchar(' ')#define pn putchar('\n')#define pb push_back#define fi first#define se...
2019-11-15 13:11:31 68
原创 [luogu] P1855 榨取kkksc03
二维0-1背包,跟0-1背包没啥区别,数组多开一维就行#include <bits/stdc++.h>#define numm ch - 48#define pd putchar(' ')#define pn putchar('\n')#define pb push_back#define fi first#define se second#de...
2019-11-15 10:19:00 110
原创 [SCOI2009] windy数
经典数位dpconst int maxn = 2e9 + 5;ll l, r;int dim[15];ll f[15][15];int dfs(int x, int st, int op) { if (!x) return 1; if (!op && ~f[x][st]) return f[x][st]; int max...
2019-11-15 00:39:28 62
原创 [USACO06NOV] 玉米田Corn Fields
题源:https://www.luogu.org/problemnew/solution/P1879偏模板的状压dp题。#include <bits/stdc++.h>#define numm ch - 48#define pd putchar(' ')#define pn putchar('\n')#define pb push_back#defi...
2019-11-14 16:43:03 157
原创 [USACO07DEC]手链Charm Bracelet
题源:https://www.luogu.org/problem/P28710-1背包模板题int n, m;int c[3500], w[3500];int dp[20000] = {0};int main() { read(n), read(m); for (int i = 1; i <= n; i++) { read(c...
2019-11-14 04:49:11 162
原创 矩阵加速
题面<center>矩阵加速<center><center>时间限制1.00s 内存限制125.00MB<center>题目描述a[1]=a[2]=a[3]=1a[x]=a[x-3]+a[x-1] (x>3)求a数列的第n项对1000000007(10^9+7)取余的值。输入格式第一行一个整数T,表示询问个数。以下T行...
2019-11-13 19:24:42 88
原创 [模板] KMP
题源:https://www.luogu.org/problem/P3375#include <bits/stdc++.h>#define numm ch - 48#define pd putchar(' ')#define pn putchar('\n')#define pb push_back#define fi first#define se...
2019-11-12 23:55:07 57
原创 It's a Mod, Mod, Mod, Mod World
upc组队训练赛D题题面<center>问题 D: It’s a Mod, Mod, Mod, Mod World<center><center>时间限制: 2 Sec 内存限制: 128 MB<center>题目描述You are given multiple problems with three integers p,...
2019-11-11 14:32:25 133
原创 [模板] manachar
题源:https://www.luogu.org/problem/P3805manacher算法,就是在字符之间插入特殊字符避免奇偶分类讨论然后利用之前的已有的回文信息计算回文半径。#include <bits/stdc++.h>#define numm ch - 48#define pd putchar(' ')#define pn putchar('...
2019-11-11 14:12:09 94
原创 最短路算法之SPFA算法
南昌网络赛H题签到题题面As the current heir of a wizarding family with a long history,unfortunately, you find yourself forced to participate in the cruel Holy Grail War which has a reincarnation of si...
2019-11-11 04:28:46 87
原创 [模板] Alpha-Beta 剪枝
题源:https://nanti.jisuanke.com/t/A1538#include <bits/stdc++.h>#define numm ch - 48#define pd putchar(' ')#define pn putchar('\n')#define pb push_back#define fi first#define se ...
2019-11-11 01:47:59 162
原创 [模板] 扫描线(面积并)
题源:https://www.luogu.org/problem/P5490#include <bits/stdc++.h>#define numm ch - 48#define pd putchar(' ')#define pn putchar('\n')#define pb push_back#define fi first#define se...
2019-11-10 21:55:42 127
原创 [模板] zkw线段树
题源:https://www.luogu.org/problem/P3372非递归线段树 不能处理混合优先级code#include <bits/stdc++.h>#define numm ch - 48#define pd putchar(' ')#define pn putchar('\n')#define pb push_back#define...
2019-11-09 14:46:18 82
原创 [模板] 线段树
题源:https://www.luogu.org/problem/P3373code#include <bits/stdc++.h>#define numm ch - 48#define pd putchar(' ')#define pn putchar('\n')#define pb push_back#define fi first#defin...
2019-11-09 04:49:16 75 1
原创 [模板] 最长公共子序列
题源:https://www.luogu.org/problem/P1439tips问题能转化成二分求最长上升子序列lower_bound() 返回第一个大于等于查询值的位置lower_bound() 返回第一个小于查询值的位置binary_search() 返回判断查询值在不在的 bool 值code#include <bits/stdc++.h>#def...
2019-11-07 13:52:54 88
原创 [模板] 快速幂
题源:https://www.luogu.org/problem/P1226tips每进行一步运算时都要把得到的答案对c取模。a b c ans 都要定义成 long long 型变量。不要认为运算过程中对答案取模就够了,再输出答案的时候不要忘记把最终的答案再对c取一次模。code#include <bits/stdc++.h>#define numm ch...
2019-11-06 22:07:15 71
原创 [模板]堆(优先队列)
题源:https://www.luogu.org/problem/P3378定义priority_queue<int> q;//这是一个大根堆qpriority_queue<int,vector<int>,greater<int> >q;//这是一个小根堆q操作q.top()//取得堆顶元素,并不会弹出q.pop()//弹...
2019-11-06 19:38:15 171
原创 [模板] 裴蜀定理
题源:https://www.luogu.org/problem/P4549code#include <bits/stdc++.h>#define numm ch - 48#define pd putchar(' ')#define pn putchar('\n')#define pb push_back#define fi first#defin...
2019-11-06 18:23:06 69
原创 [模板] 并查集
题源:https://www.luogu.org/problem/P3367tips1.查找时顺手路径压缩。while(x!=fa[x]) x=fa[x]=fa[fa[x]];2.合并操作先将二者追溯到最新的祖先,然后再更新。fa[find(x)]=find(y);//其中find(x)为x的祖先code#include <bits/stdc++.h>#de...
2019-11-06 06:26:39 58
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人