05 2020 档案

摘要:#pragma GCC optimize (3,"inline","Ofast") #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N=505; const ll inf=1e18; ll n, 阅读全文
posted @ 2020-05-30 11:38 晴屿 编辑
摘要:#pragma GCC optimize(2) #include<bits/stdc++.h> #define ll long long const int maxn=1000005; const int inf=0x3f3f3f3f; using namespace std; ll dp[maxn 阅读全文
posted @ 2020-05-29 16:17 晴屿 编辑
摘要:#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=500005; const ll INF=(1LL<<60)-1; int a[N]; ll sum[N]; int main() { int 阅读全文
posted @ 2020-05-29 02:08 晴屿 编辑
摘要://存在一个k,i<j<k,且q[k]<q[i]<q[j] //就不能放在一个栈内 //然后枚举一下所有的i j //如果满足上面的条件,就连一条边 //然后判断是不是二分图 //左边是第一个栈,右边是第二个栈 #include<cstdio> #include<cstring> #include< 阅读全文
posted @ 2020-05-29 02:06 晴屿 编辑
摘要:想明白之后就是,路径条数 #include<bits/stdc++.h> using namespace std; typedef long long ll; ll a,b,c,d; inline ll read() { ll x=0,w=1; char c=getchar(); while(c<' 阅读全文
posted @ 2020-05-29 01:55 晴屿 编辑
摘要:#include<bits/stdc++.h> using namespace std; const int N=1e6+10; int a[N]; int n; int tr[N]; int f[N]; int ans; int lowbit(int x) { return x&-x; } voi 阅读全文
posted @ 2020-05-25 20:33 晴屿 编辑
摘要:#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=1e6+7; #define int long long int a[107]; int n,m; int check(int x) 阅读全文
posted @ 2020-05-25 16:01 晴屿 编辑
摘要:#include<map> #include<queue> #include<time.h> #include<limits.h> #include<cmath> #include<ostream> #include<iterator> #include<set> #include<stack> # 阅读全文
posted @ 2020-05-25 15:41 晴屿 编辑
摘要:#include <bits/stdc++.h> using namespace std; #define ll long long #define P pair<int,int> #define mk make_pair const int N = 2e3 + 10; void solve() { 阅读全文
posted @ 2020-05-25 12:15 晴屿 编辑
摘要:#include<iostream> #include<algorithm> #include<cstdio> #include<cstring> using namespace std; const int maxn=15,maxx=100005; int tmp[maxn],vis[10]; l 阅读全文
posted @ 2020-05-22 03:27 晴屿 编辑
摘要:#include <cstring> #include <iostream> #include <algorithm> #include <vector> using namespace std; typedef unsigned long long ULL; const int N = 5e5+1 阅读全文
posted @ 2020-05-21 19:46 晴屿 编辑
摘要:#include <bits/stdc++.h> #define N 300005 #define ll long long using namespace std; int n,m,tot,opcnt,qcnt,B,now; int a[N],A[N],output[N],cnt[N],mex[N 阅读全文
posted @ 2020-05-21 12:42 晴屿 编辑
摘要:#pragma GCC optimize(2) #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const int N=39,M=150; int n,m,t 阅读全文
posted @ 2020-05-21 11:05 晴屿 编辑
摘要:#include<bits/stdc++.h> using namespace std; const int N=100010; int a[N],belong[N]; int n,q,k; inline int read() { int k=0; char c; c=getchar(); whil 阅读全文
posted @ 2020-05-21 00:47 晴屿 编辑
摘要:#include<bits/stdc++.h> using namespace std; const int N=100010; int a[N],belong[N]; int n,q; inline int read() { int k=0; char c; c=getchar(); while( 阅读全文
posted @ 2020-05-21 00:29 晴屿 编辑
摘要:#include <bits/stdc++.h> using namespace std; const int N=2020; int f[N][N][2],a[N]; int main() { int n; cin>>n; for(int i=1; i<=n; i++) cin>>a[i]; fo 阅读全文
posted @ 2020-05-20 23:04 晴屿 编辑
摘要:```#include#include#include#include#includeusing namespace std;const int N = 400005;int n, m;int h[N], e[N], ne[N], idx;int dfn[N], low[N], timestamp;int stk[N], top;bool in_stk[N];int id[N];int scc_c... 阅读全文
posted @ 2020-05-20 16:36 晴屿 编辑
摘要:``` #include #include #include #include using namespace std; typedef long long ll; const int N = 1000010, M =1000010; inline int read() { int x=0,t=1; char ch=getchar(); while(ch>'9'||ch='0'&&ch 1) cu 阅读全文
posted @ 2020-05-20 11:30 晴屿 编辑
摘要:参考:https://www.luogu.com.cn/blog/Sooke/solution p2569 阅读全文
posted @ 2020-05-19 11:59 晴屿 编辑
摘要:``` #include #include #include #include #include #include #include using namespace std; template//据说可以自动判断输入的类型 void read(int_t& x) { x=0; int_t k=1; char ch=0; while(ch'9') {ch=getchar();if(ch=='-') 阅读全文
posted @ 2020-05-19 10:32 晴屿 编辑
摘要:``` #include #include #include #include #include using namespace std; typedef long long ll; const int N=500005; const int inf=1e9; ll num[N],pos[N]; ll dp[N]; ll q[N]; int n,d,lim; bool check(int mind 阅读全文
posted @ 2020-05-18 23:20 晴屿 编辑
摘要:``` #include #include #include #include #include using namespace std; const int N=4005; const int inf=0x3f3f3f3f; //求这n天每天从1到m的距离和与更改道路的价值之和的最小值. int dp[N],now[N],limit[N][N],dist[N]; bool st[N]; int 阅读全文
posted @ 2020-05-18 17:26 晴屿 编辑
摘要:``` #include #include #include #include #include using namespace std; typedef long long LL; const int N = 2500001; int e[N],ne[N],idx,h[N],w[N]; int vis[N]; int dist[N]; int n,m,k; int s,t; struct Dij 阅读全文
posted @ 2020-05-18 13:30 晴屿 编辑
摘要:``` //k可能是负数,所以斜率不在有单调性 //新加的点的横坐标还是单调递增的,但可能不是严格的 //在查询的时候:只能二分查找 //在插入的时候:将队尾不在凸包上的点删掉 //f[j]=(sumt[i]+s)*sumc[j]+f[i]-sumt[i]*sumc[i]-s*sumc[n] //f[i]=f[j]-(sumt[i]+s)sumc[j]+sumt[i]*sumc[i]+s*sumc 阅读全文
posted @ 2020-05-18 11:40 晴屿 编辑
摘要:``` #include using namespace std; const int N=110; typedef long long ll; typedef pair pii; #define int ll int T,n,m; int in[N][N],dp[N][N]; set st; signed main() { cin>>T; while(T--) { cin>>n>>m; st.c 阅读全文
posted @ 2020-05-16 21:47 晴屿 编辑
摘要:``` #include using namespace std; const int N= 1e6 + 5; char a[N]; int dp[N],s[N]; int main() { int t; scanf("%d", &t); while(t--) { int n, k; scanf("%d%d", &n, &k); scanf("%s", a + 1); dp[0]=dp[1]=0; 阅读全文
posted @ 2020-05-16 21:46 晴屿 编辑
摘要:```#include#include#include#include#includeusing namespace std;const int N=111111;int f[N][21];int e[N],ne[N],h[N],idx,w[N];int n,m,s,t,k;void add(int a,int b,int c){ e[idx]=b; w[idx]=c; ne[idx]=h[a];... 阅读全文
posted @ 2020-05-14 19:33 晴屿 编辑
摘要:```#include#include#include#includeusing namespace std;const int N=210;int f[N][N];int e[N],ne[N],h[N],idx,w[N];int n,m;void add(int a,int b,int c){ e[idx]=b; w[idx]=c; ne[idx]=h[a]; h[a]=idx++;}void ... 阅读全文
posted @ 2020-05-14 19:01 晴屿 编辑
摘要:``` #include #include #include #include #include #include using namespace std; const int N=50000*2; const int mod=100000000; int n,m,b; int e[N],ne[N],idx,h[N],w[N]; int fi[N]; const int inf=0x3f3f3f3 阅读全文
posted @ 2020-05-14 13:46 晴屿 编辑
摘要:``` #include #include #include #include #include using namespace std; const int N=15,M=1state[N]; bool check(int k,int state) { for(int i=0; i>i&1 && state>>i+1&1))||((state>>i&1 && !g[k][m-i]))) retu 阅读全文
posted @ 2020-05-14 13:19 晴屿 编辑
摘要:```#include#include#include#includeusing namespace std;typedef long long ll;const int N=15,K=110,M=1head[M];vectorstate;bool check(int x){ for(int i=0; i+1>i&1) && (x>>i+1&1)) return false; return t... 阅读全文
posted @ 2020-05-14 13:02 晴屿 编辑
摘要:``` #include #include #include #include using namespace std; const int N=310; int n,m; int h[N],e[N],ne[N],idx; int w[N]; int f[N][N]; void add(int a,int b) { e[idx]=b; ne[idx]=h[a]; h[a]=idx++; } voi 阅读全文
posted @ 2020-05-14 01:44 晴屿 编辑
摘要:``` #include #include #include #include #define ll long long using namespace std; const int N=1010; bool x[N],y[N]; char s[N][N]; bool st[N][N]; int n,m; int dx[]={1,-1,0,0}; int dy[]={0,0,1,-1}; void 阅读全文
posted @ 2020-05-13 23:15 晴屿 编辑
摘要:``` #include #include using namespace std; const int N=205; int n,m; int t[N]; int f[N][N]; void update(int k) { for(int i=0; if[i][k]+f[k][j]) f[i][j]=f[j][i]=f[i][k]+f[k][j]; } int main() { cin>>n>> 阅读全文
posted @ 2020-05-13 22:07 晴屿 编辑
摘要:```#include#include#include#include#include#include#includeusing namespace std;const int N=2000000+10;const int mod=100003; int e[N],ne[N],h[N],idx;int n,m;int ans[N];queueq;bool st[N];int d[N];int mi... 阅读全文
posted @ 2020-05-13 15:38 晴屿 编辑
摘要:```#include#include#include#include#include#includeusing namespace std;#define x first#define y secondtypedef pairpii;const int N=5050;const int INF=1e9;pii p[N];double dist[N];bool vis[N];int n;doubl... 阅读全文
posted @ 2020-05-13 15:11 晴屿 编辑
摘要:``` //图是不一定联通的 //于是,我们就可以将整张图切分成许多分开的连同子图来处理 //每一条边所连接的点中,至少要有一个被选中 //每一条边所连接的两个点,不能被同时选中 //所以:每一条边都有且仅有一个被它所连接的点被选中 //因为要处理的是一个连通图,所以,对于这一个图的点的选法,可以考虑到相邻的点染成不同的颜色 // 于是,对于一个连通图,要不就只有两种选法(因为可以全部选染成一种色 阅读全文
posted @ 2020-05-13 14:47 晴屿 编辑
摘要:``` #include #include #include #include #include using namespace std; typedef long long ll; #define int long long const int N=1010; typedef pairpii; int n,m,Q; char s[N]; int a[N][N]; int f[N][N]; int 阅读全文
posted @ 2020-05-13 14:15 晴屿 编辑
摘要:```#include#define ll long long#define pii pairusing namespace std;const int N = 1e5+10;int a[N],n,k;void solve(){ cin>>n>>k; for(int i=1; i>a[i]; int f2=0; int f1=0; for(int i=1; i=k && a[i+1]>=k ) ... 阅读全文
posted @ 2020-05-13 14:14 晴屿 编辑
摘要:``` #include #include #include #include #include #define ll long long using namespace std; const int N=200005; int primes[N]; bool st[N]; int cnt; void init(int n) { memset(st, 0, sizeof st); cnt = 0; 阅读全文
posted @ 2020-05-13 14:08 晴屿 编辑
摘要:``` #include #include #include #include using namespace std; typedef long long ll; #define int long long const int N = 200000+10; int a[N]; bool st[N]; int dp[N]; void solve() { int n; cin>>n; for(int 阅读全文
posted @ 2020-05-13 14:07 晴屿 编辑
摘要:``` #include #include #include #include using namespace std; const int N = 200000+10, M = 200000+10; int n, m; int h[N], e[M], ne[M], idx; int dfn[N], low[N], timestamp; // 栈顶 int stk[N], top; bool in 阅读全文
posted @ 2020-05-12 18:53 晴屿 编辑
摘要:``` #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep_1(i,m,n) for(int i=m;i='0'&&ch='0'&&ch pii; ty 阅读全文
posted @ 2020-05-12 18:26 晴屿 编辑
摘要:``` #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep_1(i,m,n) for(int i=m;i='0'&&ch='0'&&ch pii; ty 阅读全文
posted @ 2020-05-12 18:13 晴屿 编辑
摘要:```//稠密图#include #include #include using namespace std;const int N = 100010, M = 200010, INF = 0x3f3f3f3f;int n, m;int p[N];struct Edge { int a, b, w; bool operator< (const Edge &W)const { ... 阅读全文
posted @ 2020-05-12 13:37 晴屿 编辑
摘要:太难了,参考题解:https://www.luogu.com.cn/blog/An Fly/soluti p5774 阅读全文
posted @ 2020-05-12 12:13 晴屿 编辑
摘要:```#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define rep_1(i,m,n) for(int i=m;i '9') && c != '-'); if (c == '-') bo = ... 阅读全文
posted @ 2020-05-12 10:53 晴屿 编辑
摘要:``` #include #include #include #include #define ll long long #define MD 1000000007 using namespace std; int s1[1005],s2[1005]; int st[1005]; ll f[1005][15][15][2][2][2]; //pos 最大有1000位所以开到1000+ string 阅读全文
posted @ 2020-05-11 21:37 晴屿 编辑
摘要:``` #include #include #include #include #define MAXN 2147483647 #define ll long long using namespace std; const int mod=1e7+7; int len; ll n; int a[55]; ll dp[55][55]; ll dfs(int p,int st,int limit) { 阅读全文
posted @ 2020-05-11 20:31 晴屿 编辑
摘要:```#include#include#include#include#define rint register intusing namespace std;typedef long long ll;int mod,a[20];ll l,r,dp[19][163][163];inline ll dfs(int pos,int sum,int now,int limit){ //剩下的都是最大的也... 阅读全文
posted @ 2020-05-11 20:04 晴屿 编辑
摘要:```#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define rep_1(i,m,n) for(int i=m;i='0'&&ch='0'&&ch pii;typedef unsigned l... 阅读全文
posted @ 2020-05-11 19:22 晴屿 编辑
摘要:``` #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep_1(i,m,n) for(int i=m;i pii; typedef unsigned l 阅读全文
posted @ 2020-05-11 09:44 晴屿 编辑
摘要:``` #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep_1(i,m,n) for(int i=m;i pii; typedef unsigned l 阅读全文
posted @ 2020-05-11 09:43 晴屿 编辑
摘要:``` #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep_1(i,m,n) for(int i=m;i pii; typedef unsigned l 阅读全文
posted @ 2020-05-11 09:41 晴屿 编辑
摘要:``` #include #include #include #include #define ll long long const int N = 1E6; const int mod = 1E9 + 9; using namespace std; int dp[5][5][30][30][30]; //预处理出a,b, c字符串中任意字母 和中间两个任意符号的情况数 void init() { 阅读全文
posted @ 2020-05-11 09:40 晴屿 编辑
摘要:``` //桥:删掉之后,图就不连通 //边双连通分量:极大的不含有桥的连通块 //不管删掉哪条边,都是连通的 //任意两个点之间,至少存在两条不相交的路径 //割点:如果把某个点和它所关联的所有边都删掉,图就不连通 //每一个割点至少属于两个双连通分量 //点双连通分量:极大的不包含割点的连通块 //两个割点之间的边,不一定是桥 //一个桥的两个端点,不一定是桥 //边双连通分量不一定是点双连通 阅读全文
posted @ 2020-05-08 23:20 晴屿 编辑
摘要:``` //这题图不一定联通,开始没看清,然后wa了几发。 #include #include #include using namespace std; const int N = 5010, M = 20010; int n, m; int h[N], e[M], ne[M], idx; int dfn[N], low[N], timestamp; //栈 栈顶 int stk[N], top 阅读全文
posted @ 2020-05-08 22:39 晴屿 编辑
摘要:``` #include #include #include #include #include using namespace std; const int N = 1e3 + 10; const int M = 2e6 + 10; int n, m; int g[N][N]; int h[N], e[M], ne[M], idx; int dfn[N], low[N], num, stac[N 阅读全文
posted @ 2020-05-08 17:50 晴屿 编辑
摘要:```//对于一个有向图,连通分量:对于分量中任意两点uv,//必然可以从u走到v,也可以从v走到u//强连通分量(scc):极大连通分量,也就是加上任何一个点之后,都不是连通分量//有向图通过缩点,转化为有向无环图(DAG),拓扑图//缩点是指将所有连通分量缩成一个点//Tarjan算法求scc//对每个点定义两个时间戳//dfn[u]表示遍历到u的时间戳//low[u]表示从u开始走,所能遍历... 阅读全文
posted @ 2020-05-08 17:39 晴屿 编辑
摘要:``` //桥:删掉之后,图就不连通 //边双连通分量:极大的不含有桥的连通块 //不管删掉哪条边,都是连通的 //任意两个点之间,至少存在两条不相交的路径 //割点:如果把某个点和它所关联的所有边都删掉,图就不连通 //每一个割点至少属于两个双连通分量 //点双连通分量:极大的不包含割点的连通块 //给定一个无向连通图,问最少加几条边,可以将其变成一个边双连通分量 //求双连通分量,缩点 //缩 阅读全文
posted @ 2020-05-08 17:34 晴屿 编辑
摘要:```#include#include#include#includeusing namespace std;#define int long longconst int N=1e6+10;const int mod=1e9+7;int t;int l,r;int q[N];int dp[200][200];int dfs(int poj,int sum,bool limit){ if(!poj)... 阅读全文
posted @ 2020-05-08 00:38 晴屿 编辑
摘要:```#include#include#include #define Calc(i,j) (f[j-1]-f[i-1])/(a[i].h-a[j].h)using namespace std;const int N=1e5+9;int q[N];double f[N],k[N];struct Land{ int w,h;//结构体排序 inline bool operatorx.h||(h==x... 阅读全文
posted @ 2020-05-07 23:24 晴屿 编辑
摘要:``` #include #include using namespace std; #define int long long const int N=1e6+10,INF=1e9; int n,m; int x[N]; int p[N]; int c[N]; int q[N]; int f[N]; int sump[N];//p[i] int sum[N];//p[i]*x[i] //f[i] 阅读全文
posted @ 2020-05-07 23:05 晴屿 编辑
摘要:```#include#include#include#includeusing namespace std;typedef long long LL;const int maxn = 1e5 + 5;const int inf = 1e6 + 5;int a[maxn],d[maxn];int main(){ int T,n; scanf("%d",&T); for(int cas=1; cas... 阅读全文
posted @ 2020-05-07 16:51 晴屿 编辑
摘要:``` #include #include #include #include #include #include using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; const int maxn = 305; int main() { int T; ll n,k; ll t; cin>>T; //拆成连续的数,然后 阅读全文
posted @ 2020-05-07 16:34 晴屿 编辑
摘要:``` #include #include #include #include using namespace std; const int N = 500010; int arr[N]; int city,box; bool check(int mid) { int sum = 0; for (int i = 0; i >1; if(check(mid)) r=mid; else l=mid+1 阅读全文
posted @ 2020-05-07 16:24 晴屿 编辑
摘要:``` #include #include #include #include using namespace std; typedef long long LL; const int N=1e5+10; int n,ans[N],tr[N],hi[N]; struct node { int h,k,id; } po[N]; int cmp(node a,node b) { return a.h> 阅读全文
posted @ 2020-05-07 16:12 晴屿 编辑
摘要:``` #include #include #include #include using namespace std; const double eps=1e-9; const double pie=3.1415926535; int T; double br,tr,H,v; double getV(double h) { double rr=(tr-br)*h/H+br; //相似三角形 re 阅读全文
posted @ 2020-05-07 14:11 晴屿 编辑
摘要:``` #include #include #include #include #include using namespace std; typedef long long ll; mapmp1; int cnt; void init() { cnt=2; mp1[1]=2; mp1[2]=7; while(mp1[cnt]>n; int ans=0; while(n>=2) { int l=1 阅读全文
posted @ 2020-05-07 12:33 晴屿 编辑
摘要:``` #include #include #include #include #include #define pi acos(-1.0) using namespace std; const int maxn = 10005; int r[maxn]; double v[maxn]; int n,f; bool check(double x) { int cnt = 0; int t = lo 阅读全文
posted @ 2020-05-07 01:20 晴屿 编辑
摘要:```#include#include#include#includeusing namespace std;const int maxx = 50000 + 500;int ll,n,m;int pos[maxx];bool check(int num) //判断当最小距离为num的时候是否要拿走的石头多于M{ int cnt = 0; int last = 0; pos[0] = 0; pos... 阅读全文
posted @ 2020-05-07 01:12 晴屿 编辑
摘要:```#include#include#include#includeusing namespace std;const int maxn = 100000+5;int n,a[maxn],m;bool check(int d){ int cnt=0; for(int i = 0; i =m) return 1; else return 0;}int main(){ while(scan... 阅读全文
posted @ 2020-05-07 00:59 晴屿 编辑
摘要:```#include#include#include#include#includeconst int maxn = 1e5+10;using namespace std;long long k;int n;long long a[maxn];long long ans=0;long long maxt=0;bool check(int mid){ long long hott=0; for(i... 阅读全文
posted @ 2020-05-07 00:48 晴屿 编辑
摘要:``` #include #include #include #include #include #include #include #define pi acos(-1.0) #define ll long long int using namespace std; const int M=(int)1e5; const ll mod=(ll)1e9 + 7; const ll inf=0x3f 阅读全文
posted @ 2020-05-07 00:36 晴屿 编辑
摘要:``` #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep_1(i,m,n) for(int i=m;i>re; for(int i=0; i>num[ 阅读全文
posted @ 2020-05-06 22:02 晴屿 编辑
摘要:``` //单点修改 pushup //查询区间内的最大字段和 #include #include #include #include using namespace std; const int N = 500010; int n, m; int w[N]; struct Node { //端点 int l, r; int sum;//区间和 //最大前缀和 //分两种:没有超过mid,超过mi 阅读全文
posted @ 2020-05-06 19:09 晴屿 编辑
摘要:``` #include #include #include #include using namespace std; const int N=3030,INF=0x3f3f3f3f; int V,P,X[N],dp[N][N],w[N][N],d[N][N]; void init() { for(int l=1; l>1]; } } int main() { cin>>V>>P; for(in 阅读全文
posted @ 2020-05-06 15:37 晴屿 编辑
摘要:``` #include #include #include #include #include using namespace std; const int N = 30; const int dx[4] = { -1, 0, 1, 0 }; const int dy[4] = { 0, -1, 0, 1 }; int n, m; int sr, sc, er, ec; char g[N][N] 阅读全文
posted @ 2020-05-06 12:50 晴屿 编辑
摘要:```//以u为根节点//找u的最大子树 中的最大分支//直接连到u上//看看能不能满足条件#include #include #include #include using namespace std;const int N = 400010;struct Node{ int fi, se; void insert(int x) // 向最大值和次大值中插入一个值 { if (x > fi) ... 阅读全文
posted @ 2020-05-06 01:30 晴屿 编辑
摘要:``` #include #include #include using namespace std; typedef long long ll; const int N = 15; ll f[N][2][N][2]; int num[N]; ll dfs(int len, bool limit, int sum, bool zero, int d) { ll ret = 0; if (len = 阅读全文
posted @ 2020-05-05 23:40 晴屿 编辑
摘要:``` #include #include #include #include using namespace std; const int N=10005; int e[N],ne[N],idx,h[N]; int n; int cnt,bian[N],deep,tot[N],c1[N],c2[N]; long long ans; void add(int a,int b) { e[idx]=b 阅读全文
posted @ 2020-05-05 21:21 晴屿 编辑
摘要:```#include#include#include#includeusing namespace std;const int N=10005;int e[N],ne[N],idx,h[N];int n;int cnt,bian[N],deep,tot[N],c1[N],c2[N];long long ans;void add(int a,int b){ e[idx]=b; ne[idx]=h[... 阅读全文
posted @ 2020-05-05 19:59 晴屿 编辑
摘要:``` #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep_1(i,m,n) for(int i=m;i pii; typedef unsigned l 阅读全文
posted @ 2020-05-05 17:47 晴屿 编辑
摘要:``` #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep_1(i,m,n) for(int i=m;i pii; typedef unsigned l 阅读全文
posted @ 2020-05-05 15:58 晴屿 编辑
摘要:``` #include #include #include using namespace std; #define int long long typedef long long ll; const int N=50010; int w[N]; double sum[N]; double dp[N]; int q[N]; int n,l; double a(int i) { return su 阅读全文
posted @ 2020-05-05 01:28 晴屿 编辑
摘要:``` #include #include #include using namespace std; const int N=110,INF=0x3f3f3f3f; int n; int w[N]; char c[N]; int f[N][N]; int g[N][N]; int main() { cin>>n; for(int i=1; i>c[i]>>w[i]; c[i+n]=c[i]; w 阅读全文
posted @ 2020-05-04 23:09 晴屿 编辑
摘要:``` #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep_1(i,m,n) for(int i=m;i='0'&&ch='0'&&ch pii; ty 阅读全文
posted @ 2020-05-04 22:59 晴屿 编辑
摘要:```#include#include#includeusing namespace std;const int N=15;int len;int d[N];int f[N][N];int dfs(int pos,int pre,bool lead,int limit){ if(!pos) return 1; if(!limit && f[pos][pre]!=-1 && !lead) ret... 阅读全文
posted @ 2020-05-04 20:38 晴屿 编辑
摘要:``` #include #define ll long long using namespace std; const int N=1005; const int M=10005; int n,m,a[N],b[N],c[N]; int dp[N][M];//dp[i,j]从前i个中拿,体积为j的最大价值 int dp1[N][M];//dp1[i,j]从后i个中拿,体积为j的最大价值 int 阅读全文
posted @ 2020-05-04 20:22 晴屿 编辑
摘要:```#include #include #include #include using namespace std;const int N = 3030;int h[N], e[N], ne[N], w[N], idx;int val[N];int n, m;//n为整个有线电视网的结点总数,m为用户终端的数量int dp[N][N];//dp[i][j]表示i节点,选j个用户,能得到的钱的最大... 阅读全文
posted @ 2020-05-03 19:35 晴屿 编辑
摘要:```#include#include#include#includeusing namespace std;const int N=310;int n,m;int h[N],e[N],ne[N],idx;int w[N];int f[N][N];void add(int a,int b){ e[idx]=b; ne[idx]=h[a]; h[a]=idx++;}void dfs(int u){ ... 阅读全文
posted @ 2020-05-03 18:16 晴屿 编辑
摘要:```#include #include #include using namespace std;const int N = 2e5 + 10;int h[N], e[N], ne[N], idx;int ans[N];int a[N];int f[N][25];int n, m;void add(int a, int b){ e[idx] = b; ne[idx] = h[a]; h[a] =... 阅读全文
posted @ 2020-05-03 01:36 晴屿 编辑
摘要:```//f[i]表示从前i头牛中选,且合法,的所有方案,价值最大//第i头选或不选都可以//不选:变成f[i-1]//选i:需要知道从i开始往前连续选了多少个,最多是k//如果是x个,那么就加上w[i-x+1]+w[i-x+2]...+w[i],也就是s[i]-s[i-j]//那么再往前选的话,下标需要#include #include using namespace std;typedef l... 阅读全文
posted @ 2020-05-02 21:53 晴屿 编辑
摘要:``` #include #include #include using namespace std; const int N = 500; int f[N][N]; int h[N], e[N], ne[N], idx; int n, p; int ans = 0x3f3f3f3f; int in[N]; void add(int a, int b) { e[idx] = b; ne[idx] 阅读全文
posted @ 2020-05-02 21:43 晴屿 编辑
摘要:``` #include #include #include #include using namespace std; const int N = 505; int n, k; int a[N], b[N]; bool f[N][N]; int main() { scanf("%d%d", &n, &k); long long sum_a = 0, sum_b = 0; for(int i = 阅读全文
posted @ 2020-05-02 16:48 晴屿 编辑
摘要:``` #include using namespace std; typedef long long ll; const ll mod = 1e9 + 7; const int N = 5010; char str1[N], str2[N]; int p[N], a[N], mod2; ll dp[N][65][65]; ll dfs(int pos, int sum, int last, bo 阅读全文
posted @ 2020-05-02 15:23 晴屿 编辑

点击右上角即可分享
微信分享提示