自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(91)
  • 收藏
  • 关注

转载 南昌网络赛 H The Nth Item

南昌网络赛The Nth Item 暴力快速幂+unordered_map记忆化注意:记忆化不能写到快速幂求解函数里,不断调用函数会造成很大的时间浪费#include<bits/stdc++.h>using namespace std;#define sc(x) scanf("%lld",&x);#define si signed#d...

2019-09-09 14:37:00 181

转载 Who is better?

徐州网络赛A所谓斐波那契博弈考场推了个假规律自闭==import java.math.BigInteger;import java.util.ArrayList;import java.util.Scanner; public class Main { static BigInteger m[]=new BigInteger[...

2019-09-07 18:38:00 186

转载 D. Treasure Island

D. Treasure Islanddfs大法好==写半天bfs疯狂MLEdfs标记掉路上的一些点然后再跑一遍dfs#include<bits/stdc++.h>using namespace std;#define int long long#define sc(x) scanf("%I64d",&x);#define rea...

2019-09-04 21:55:00 283

转载 南京网络赛 E K Sum

K Sum终于过了这玩意啊啊啊====莫比乌斯反演,杜教筛,各种分块,积性函数怎么线性递推还很迷==,得继续研究研究#include<bits/stdc++.h>using namespace std;#define int long long#define maxn 1000000+10int P[maxn],g[maxn];bool v...

2019-09-04 10:55:00 144

转载 南京网络赛C

分段打表大法好!!!打表40min,A题1shttps://nanti.jisuanke.com/t/41300#include<bits/stdc++.h>#define int long longusing namespace std;#define mod 998244353const int maxn=100000+2;int P[...

2019-09-02 16:08:00 313

转载 2019 南京网络赛A

南京网络赛自闭现场https://nanti.jisuanke.com/t/41298二维偏序经典题型二维前缀和!!!#include<bits/stdc++.h>using namespace std;#define int long long#define sc(x) scanf("%lld",&x);int T;#defi...

2019-09-01 18:44:00 90

转载 D2. Equalizing by Division (hard version)

D2. Equalizing by Division (hard version)涉及下标运算一定要注意下标是否越界!!!思路,暴力判断以每个数字为到达态最小花费#include<bits/stdc++.h>using namespace std;#define sc(x) scanf("%I64d",&x);#define read...

2019-08-31 08:25:00 158

转载 P3379 【模板】最近公共祖先(LCA)

P3379 【模板】最近公共祖先(LCA)LCA模板询问离线 tarjan算法#include<bits/stdc++.h>using namespace std;vector<int> v[500000+5];int N,M,root;bool vis[500000+5];struct Q{ int x,y;...

2019-08-30 18:57:00 105

转载 【模板】线段树 2

【模板】线段树 2乘法懒标等于0也要下传,每次乘法操作对加法也要进行#include<bits/stdc++.h>using namespace std;#define int long longconst int maxn=1e5+10;int v[maxn*4],L[maxn*4],R[maxn*4],lazy1[maxn*4],lazy2[...

2019-08-30 08:31:00 107

转载 B. Array K-Coloring

B. Array K-Coloring给定一个数组要求对元素进行染色,满足相同元素颜色一定不同,且所有颜色要全部用完#include<bits/stdc++.h>using namespace std;#define sc(x) scanf("%I64d",&x);#define int long longvector<int&g...

2019-08-28 12:40:00 248

转载 D. Print a 1337-string...

D. Print a 1337-string...输出一个字符串里面包含n个子序列 1337#include<bits/stdc++.h>using namespace std;#define sc(x) scanf("%I64d",&x);#define int long longint t,n;int C[100005];v...

2019-08-28 11:57:00 151

转载 P2962 [USACO09NOV]灯Lights

P2962 [USACO09NOV]灯Lightsguass消元异或方程组#include<bits/stdc++.h>using namespace std;#define maxn 100#define sc(x) scanf("%lld",&x);#define int long longint A[maxn][maxn];i...

2019-08-27 13:58:00 132

转载 P1041 传染病控制

https://www.luogu.org/problem/P1041#include<bits/stdc++.h>using namespace std;#define int long long#define sc(x) scanf("%lld",&x);const int maxn = 1000;int n,m,tot=1,ans=5...

2019-08-27 11:52:00 192

转载 B. Uniqueness

B. Uniqueness给定一个序列,要求删除一段连续子段,满足删掉子段后每个元素唯一求最小子段长度枚举起点,二分子段长度记得先sort 再unique#include<bits/stdc++.h>using namespace std;#define int long long#define si signed#define end...

2019-08-26 10:44:00 227

转载 D. Restore Permutation

D. Restore Permutation就是给一个n个数的全排,然后bi记录比ai小且在排在ai前面的数的和,求ai树状数组维护,二分#include<bits/stdc++.h>using namespace std;#define int long long#define si signed#define endl '\n'#d...

2019-08-26 10:39:00 248

转载 array

array权值线段树查询剪枝疯狂RE#include<bits/stdc++.h>using namespace std;#define int long long#define maxn 100000+500#define inf n+1int L[maxn*4],R[maxn*4],V[maxn*4];int A[maxn],B...

2019-08-24 11:30:00 118

转载 Anniversary party

Anniversary party树形dpdp[i][0]=(i的全部员工的max(dp[u][1],dp[u][0)相加,也就是其子员工来或不来的最大快乐值。dp[i][1]=(i的全部员工的dp[u][0相加,也就是其子员工都不能不来的最大快乐值。#include <cstdio>#include <iostream>#includ...

2019-08-22 15:25:00 105

转载 1358. 分割树

1358. 分割树现在有一棵树T,有N个节点,我们想通过去掉一个节点p来把T分割成更小的树,并且满足每个小树中的节点数不超过n/2。请根据输入的树来输出所有可能的p的号码。树形dp在遍历树的过程中,访问每个node,维护两个值:所有子树的结点数的最大值childmax所有子树(这里包括node)的结点数之和sum。递归过程中用上一层的sum,不断更新这...

2019-08-22 14:52:00 1066

转载 Tree and Permutation

Tree and Permutation给出一个1,2,3...N的排列,显然全部共有N!种排列,每种排列的数字代表树上的一个结点,设Pi是其中第i种排列的相邻数字表示的结点的距离之和,让我们求sum(Pi)(1<=i<=N!)。可以设dis(i, j)为树上任意两点间的最短距离,每两点之间的距离都出现了 (N-1)!次,所求答案为 (N-1)! * sum(dis(...

2019-08-22 14:41:00 184

转载 码队的新桌游

码队的新桌游树状数组、离散化、二维偏序#include <bits/stdc++.h>///即找x.a<y.b<x.c&&y.a<x.b<y.c的组数using namespace std;struct Item { int a, b, c; int id; int ans;...

2019-08-22 11:36:00 116

转载 关于优先队列重载运算符

struct Item { int a, b, c; int id; int ans; explicit Item(int _a = 0, int _b = 0, int _c = 0) : a(_a), b(_b), c(_c) {}};struct cmpa { bool operator()(const Item...

2019-08-22 11:03:00 194

转载 YJJ's Salesman

YJJ's SalesmanYJJ is a salesman who has traveled through western country. YJJ is always on journey. Either is he at the destination, or on the way to destination.One day, he is going to travel...

2019-08-21 22:58:00 217

转载 E. Natasha, Sasha and the Prefix Sums

http://codeforces.com/contest/1204/problem/E给定n个 1 m个 -1的全排求所有排列的$f(a)=max(0,max_{1≤i≤l} \sum_{j=1}^{i}a_{j} )$之和组合数,枚举#include <bits/stdc++.h>using namespace std;typed...

2019-08-21 10:58:00 162

转载 C. Anna, Svyatoslav and Maps

C. Anna, Svyatoslav and Maps给定一个有向图,给定一条有向路径,求一条顶点最少的路径,使得给定的路径是它的最短路folyd预处理出任意两点间的最短路,然后判断是否可以缩点#include<bits/stdc++.h>using namespace std;#define int long longtypedef long ...

2019-08-21 09:45:00 192

转载 D1. Kirk and a Binary String (easy version)

D1. Kirk and a Binary String (easy version)01串找最长不降子序列给定字符串s,要求生成一个等长字符串t,使得任意l到r位置的最长不降子序列长度一致从后往前暴力枚举,枚举每个一替换成0后是否改变了l到r位置的最长不降子序列长度01串的最长不降子序列,可以通过线性dp求解dp i表示以i结尾的最长不降子序列长度dp[0]=d...

2019-08-21 08:58:00 246

转载 C. Almost Equal

C. Almost Equaln个数字全排成一个圈,满足任意相邻n个之和之间最大最小值之差不超过1n为偶数时不存在n为奇数,构造#include<bits/stdc++.h>using namespace std;typedef long long ll;#define sc(x) scanf("%I64d",&x);#defi...

2019-08-19 10:10:00 165

转载 D. Shortest Cycle

D. Shortest CycleA[i]&A[j]!=0连边,求图中最小环N>128 时必有3环其他暴力跑folyd最小环#include<bits/stdc++.h>using namespace std;typedef long long ll;#define sc(x) scanf("%I64d",&x);...

2019-08-19 09:44:00 167

转载 Coffee Chicken

Coffee Chicken字符串斐波那契输出第s[n]个字符串的第k位及后十位暴力算出前20项,超过20,跑dfs#include<bits/stdc++.h> using namespace std;string s[1000];typedef long long ll;ll n,k;ll A[500];string _s[...

2019-08-17 20:51:00 101

转载 Han Xin and His Troops

Han Xin and His Troops中国剩余定理JAVA板子/*中国剩余定理,根据公式需要求取大数的逆元*/import java.math.BigInteger;import java.util.ArrayList;import java.util.Scanner; public class Main { static...

2019-08-17 20:42:00 157

转载 D - Find Integer

D - Find Integer$a^{n}+b^{n}=c^{n}$给定a,n求解$b,c$三次以上没有整数解#include<bits/stdc++.h>using namespace std;typedef long long ll;ll A[500005];ll n,a;int main(){ int T;...

2019-08-17 09:53:00 148

转载 HDU 6438 Buy and Resell

高卖低买,可以交易多次维护一个优先队列,贪心相当于每天卖出用当前元素减优先队列最小得到收益用0/卖出,1/买入标志是否真实进行了交易,记录次数#include<bits/stdc++.h>using namespace std;typedef long long ll;ll A[500005];#define P pair<...

2019-08-17 09:27:00 103

转载 Xyjj’s sequence

Xyjj’s sequence#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>using namespace std;typedef long long ll;const ...

2019-08-16 23:40:00 127

转载 Planting Trees

Planting Trees给定N*N矩阵,求子矩形满足里面最大元素最小元素之差不超过M单调队列枚举上边界,下边界,及右边界,用两个单调队列,一个维护最大值,一个维护最小求左边界#include<bits/stdc++.h>using namespace std;int A[505][505];#define sc(x) scanf...

2019-08-16 17:28:00 264

转载 All-one Matrices

All-one Matrices单调栈最大全一矩阵计数#include<bits/stdc++.h>#define maxn 3005using namespace std;#define P pair<int,int>int n,m,ans,H[maxn][maxn],pre[maxn][maxn];stack<P&...

2019-08-16 11:22:00 79

转载 Beauty Values

Beauty Values题意:给$n$个数,定义它的Beauty Values为所有连续子区间的(区间长度*区间内不同数字的数目)求和求Beauty ValuesA[i]数组表示数字i最近一次出现在什么时候,增加一个数字i,A[i]之前引起的只是区间长度的变化,数字种类没有增加,dp[i]记录i和i-1之间的ans差#include<bits/stdc...

2019-08-15 22:06:00 151

转载 BM板子

BM线性递推玄学玩意struct LinearRecurrence{ using int64 = long long; using vec = std::vector<int64>; static void extand(vec& a, size_t d, int64 value = 0) { ...

2019-08-15 18:36:00 191

转载 Knapsack Cryptosystem

Knapsack Cryptosystem超大背包折半查找#include<bits/stdc++.h>using namespace std;typedef long long ll;#define P pair<ll,int>ll A[39];ll C[39];bool B[39]; ll s,_n;vect...

2019-08-15 18:21:00 149

转载 All men are brothers

All men are brothers牛客多校第九场E给定n个人,起初互不认识然后m各阶段每个阶段有两个人x、y认识求每个阶段选出四个人互不认识的方式并查集#include<bits/stdc++.h>using namespace std;typedef unsigned long long ll;ll f[100004]...

2019-08-15 18:16:00 168

转载 Quadratic equation

Quadratic equation牛客多校九B给定$(x+y)\%mod=b$$(x*y)\%mod=c$求 $x,y$二次剩余求$((x-y)^{2})\%mod = (b\times b-4\times c)\%mod$#include<bits/stdc++.h>using namespace std;typedef lon...

2019-08-15 18:03:00 265

转载 B. Equal Rectangles

B. Equal Rectangles给定4*N个数,是否能构成N个矩形面积均相等每次取两个大的,两个小的#include<bits/stdc++.h>using namespace std;typedef long long ll;#define sc(x) scanf("%I64d",&x);#define read(A) fo...

2019-08-14 22:48:00 92

空空如也

空空如也

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

TA关注的人

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