上一页 1 2 3 4 5 6 7 ··· 9 下一页
摘要: 第一道splay,算是学会了最最基础的splay操作。 有一点要特别注意,就是一字型旋转的时候要先旋转y再旋x,这样复杂度降低很多。。。不要写成两次都旋转x。。。 总算是调试好了。 #include<bits/stdc++.h> #define REP(i,a,b) for(int i=a;i<=b 阅读全文
posted @ 2016-02-18 11:18 __560 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 割点: int n; vector<int> G[maxn]; int pre[maxn],low[maxn]; int dfs_clock; bool iscut[maxn]; void init() { MS0(pre);MS0(iscut); dfs_clock=0; } int dfs(in 阅读全文
posted @ 2016-02-16 14:35 __560 阅读(260) 评论(0) 推荐(0) 编辑
摘要: http://train.usaco.org/usacoprob2?a=7BaJNgFLmpD&S=buylow 求最长递减子序列以及方案数,注意重复不算,比如 3 2 3 2 1 ,这里取到最长递减子序列算一种(3 2 1)。 思路: 最长递减子序列的长度可以直接dp: dp[i]=max(dp[ 阅读全文
posted @ 2016-02-16 11:11 __560 阅读(248) 评论(0) 推荐(0) 编辑
摘要: struct Edge { int from,to,cap,flow; }; struct Dinic { int n,m,s,t; vector<Edge> edges; vector<int> G[maxn]; bool vis[maxn]; int d[maxn]; int cur[maxn] 阅读全文
posted @ 2016-02-15 16:45 __560 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 终于过了这道题。。。但是这肯定不是正解,并没有办法证明它的正确性,但也足以过掉绝大多数数据了。 /* ID: huanrui ke PROG: camelot LANG: C++ */ #include<bits/stdc++.h> #define REP(i,a,b) for(int i=a;i< 阅读全文
posted @ 2016-02-14 11:49 __560 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Clarke and MST Accepts: 33 Submissions: 92 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) 问题描述 克拉克是一名人格分裂患者。某一天克拉克变成 阅读全文
posted @ 2016-02-13 22:21 __560 阅读(394) 评论(0) 推荐(0) 编辑
摘要: 支持多重边,按字典序输出。 #include<bits/stdc++.h> #define REP(i,a,b) for(int i=a;i<=b;i++) #define MS0(a) memset(a,0,sizeof(a)) using namespace std; typedef long 阅读全文
posted @ 2016-02-13 16:10 __560 阅读(376) 评论(0) 推荐(0) 编辑
摘要: 现在一天usaco能刷5~7道,现在刚到3.3,还有第三章8题,第四章11题,第五章14题,第六章17题,总共50题。如果一天5道,回学校前应该能刷完,但这样的训练强度根本不够!因此今天开始要增加训练强度!!! 首先是usaco,只放在早上刷,而且必须保持7道以上的题量。 接着下午一套codefor 阅读全文
posted @ 2016-02-13 03:33 __560 阅读(369) 评论(0) 推荐(0) 编辑
摘要: 网上找的模版实在是用不惯。。无奈自己写了一个。。。 下面是系数矩阵n*n,增广矩阵n*(n+1)。 最后结果为 z[i]= y[i]/x[i] ,即 x[i] * z[i] =y[i] .矩阵如下 x1 z1 y1 x1 z1 y1 x2 * z2 = y2 或 0 * z2 = 0 x3 z3 = 阅读全文
posted @ 2016-02-12 19:48 __560 阅读(198) 评论(0) 推荐(0) 编辑
摘要: StringsobitsKim Schrijvers Consider an ordered set S of strings of N (1 <= N <= 31) bits. Bits, of course, are either 0 or 1. This set of strings is i 阅读全文
posted @ 2016-02-12 08:20 __560 阅读(247) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> #define REP(i,a,b) for(int i=a;i<=b;i++) #define MS0(a) memset(a,0,sizeof(a)) using namespace std; typedef long long ll; const 阅读全文
posted @ 2016-02-10 20:50 __560 阅读(433) 评论(0) 推荐(0) 编辑
摘要: A题:水。 /* ID: huanrui ke PROG: AIM Tech Round (Div. 2) LANG: C++ */ #include<bits/stdc++.h> #define REP(i,a,b) for(int i=a;i<=b;i++) #define MS0(a) mem 阅读全文
posted @ 2016-02-06 00:00 __560 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 道路修建 Large Time Limit: 5000ms Memory Limit: 131072KB 64-bit integer IO format: %lld Java class name: Main Prev Submit Status Statistics Discuss Next T 阅读全文
posted @ 2016-02-05 20:55 __560 阅读(395) 评论(0) 推荐(0) 编辑
摘要: 用可持久化线段树维护可持久化并查集。 调了一下午,改为按秩合并就过了。。。 没路径压缩的: #include<bits/stdc++.h> #define REP(i,a,b) for(int i=a;i<=b;i++) #define MS0(a) memset(a,0,sizeof(a)) us 阅读全文
posted @ 2016-02-04 19:26 __560 阅读(274) 评论(0) 推荐(0) 编辑
摘要: poj2104 求区间第k大 可持久化线段树 #include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<algorithm> #define REP(i,a,b) for(int i=a;i<=b 阅读全文
posted @ 2016-02-04 17:43 __560 阅读(249) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=1000100; const int INF=1e9+10; /// 18位素数:154590409516822759 /// 19位素 阅读全文
posted @ 2016-02-02 02:38 __560 阅读(183) 评论(0) 推荐(0) 编辑
摘要: A题:偶数直接加进去,奇数排序后去掉最小的即可。 /* ID: NotPassedCET4 PROG: #341 LANG: C++ */ #include<bits/stdc++.h> #define REP(i,a,b) for(int i=a;i<=b;i++) #define MS0(a) 阅读全文
posted @ 2016-02-01 03:22 __560 阅读(307) 评论(0) 推荐(0) 编辑
摘要: A:直接枚举就行了。 #include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<algorithm> #include<vector> #define REP(i,a,b) for(int i=a 阅读全文
posted @ 2016-01-31 17:29 __560 阅读(203) 评论(0) 推荐(0) 编辑
摘要: struct Edge { int from,to,cap,flow,cost; }; struct MCMF { int n,m,s,t; vector<Edge> edges; vector<int> G[maxn]; int inq[maxn]; int d[maxn]; int p[maxn 阅读全文
posted @ 2016-01-31 17:16 __560 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 如题 阅读全文
posted @ 2016-01-26 14:50 __560 阅读(172) 评论(0) 推荐(0) 编辑
摘要: http://codeforces.com/contest/581/problem/F#include#define REP(i,a,b) for(int i=a;i G[maxn];int dp[maxn][maxn][2];int rt;int cnt[maxn];int f[maxn][max... 阅读全文
posted @ 2015-12-30 11:52 __560 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 这场比赛真是。。。涨分场又打成了掉分场。。。唯一的收获就是理解了扫描线,以前放弃的,现在还是得学,要是之前学了,这场D就能过了。A题:#include#define REP(i,a,b) for(int i=a;i=b;i--)#define MS0(a) memset(a,0,sizeof(a))... 阅读全文
posted @ 2015-12-28 16:54 __560 阅读(217) 评论(0) 推荐(0) 编辑
摘要: Black JackAccepts: 0Submissions: 61Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)问题描述21点又名黑杰克(英文:Blackjack),起源于法国,已流传... 阅读全文
posted @ 2015-12-27 00:26 __560 阅读(461) 评论(0) 推荐(0) 编辑
摘要: hdu5550 Game Rooms dp调了一下午的bug终于过了。。。思路是没错的,但是由于用了刷表法思考,所以只考虑刷表之后的状态,没有注意刷表前的最初状态,于是调了一下午的bug终于找出来了。。。dp[i][j][k] 表示 前i个,最后一个k的位置为j ( k取0,1,j#define R... 阅读全文
posted @ 2015-12-23 16:01 __560 阅读(443) 评论(0) 推荐(0) 编辑
摘要: #include#define REP(i,a,b) for(int i=a;i>m>>n){ if(m==0) break; REP(i,1,m) REP(j,1,n) scanf("%d",&a[j][i]); /* REP(i,1,m){... 阅读全文
posted @ 2015-12-21 16:40 __560 阅读(243) 评论(0) 推荐(0) 编辑
摘要: #include#define REP(i,a,b) for(int i=a;i>n){ REP(i,1,n) scanf("%d%d",&p[i].x,&p[i].y); REP(i,1,n) REP(j,1,n) dp[i][j]=INF*1.0; dp... 阅读全文
posted @ 2015-12-21 14:24 __560 阅读(373) 评论(0) 推荐(0) 编辑
摘要: 这场要是算分的话估计就有机会涨到紫了,4个题1A。A题:#include#define REP(i,a,b) for(int i=a;i>n>>m){ REP(i,1,n) scanf("%d",&a[i]); sort(a+1,a+n+1); int an... 阅读全文
posted @ 2015-12-20 17:13 __560 阅读(237) 评论(0) 推荐(0) 编辑
摘要: //#include#include#include#include#include#include#define REP(i,a,b) for(int i=a;i>n){ REP(i,1,n) scanf("%lld",&a[i]); s[0]=0;REP(i,1,n)... 阅读全文
posted @ 2015-12-19 21:49 __560 阅读(370) 评论(0) 推荐(0) 编辑
摘要: #include#define REP(i,a,b) for(int i=a;i q;int main(){ freopen("in.txt","r",stdin); while(cin>>n>>d,n||d){ REP(i,1,n) scanf("%1d",&a[i]);... 阅读全文
posted @ 2015-12-17 21:23 __560 阅读(211) 评论(0) 推荐(0) 编辑
摘要: #include#define REP(i,a,b) for(int i=a;i>T; int casen=1; while(T--){ scanf("%s%s",s,t); len=strlen(s); c10=c01=c1=c0=0; ... 阅读全文
posted @ 2015-12-17 21:21 __560 阅读(218) 评论(0) 推荐(0) 编辑
摘要: #include#define REP(i,a,b) for(int i=a;i>n,n){ MS0(id1);MS0(id2); int st=1; REP(i,1,n) scanf("%d",&a[i]); int ans=INF; ... 阅读全文
posted @ 2015-12-17 00:52 __560 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 看似简单的所谓坑题,其实不坑,只是需要细致周密的考虑以及造数据debug的能力,而这正是acmer必备的素质。显然我还不是合格的acmer...这题卡了我好几天。。。#include#define REP(i,a,b) for(int i=a;i>n,n){ REP(i,1,n) ci... 阅读全文
posted @ 2015-12-17 00:37 __560 阅读(294) 评论(0) 推荐(0) 编辑
摘要: #include#define REP(i,a,b) for(int i=a;i=1;i--){ R[i]=max(R[i+1],p[i]); R[i]=min(R[i],s[i]); } REP(i,1,n) d[i]=min(L[i],R[i]); ... 阅读全文
posted @ 2015-12-15 14:46 __560 阅读(170) 评论(0) 推荐(0) 编辑
摘要: #include#define REP(i,a,b) for(int i=a;i pos;bool judge(int l,int r){ if(l>=r) return 1; //coutr){ nex=li;break; } ... 阅读全文
posted @ 2015-12-13 16:04 __560 阅读(191) 评论(0) 推荐(0) 编辑
摘要: #include#define REP(i,a,b) for(int i=a;i>T; while(T--){ scanf("%d%d",&s,&n); REP(i,1,n) scanf("%d",&x[i]); MS0(cnt);MS0(m); ... 阅读全文
posted @ 2015-12-13 14:31 __560 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 2015.12.12 bestcoder的一道数位dp: http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=659&pid=1003 2015.12.20 codeforces的两道没看懂题意的题 http://c 阅读全文
posted @ 2015-12-12 23:10 __560 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 1002:这题拿两个优先队列维护一下就可以了,近期都在做这种题,然而这题居然还是不会,why am i so stupid...#include#define REP(i,a,b) for(int i=a;i>T; while(T--){ scanf("%d%d",&n,&m);... 阅读全文
posted @ 2015-12-12 22:24 __560 阅读(199) 评论(0) 推荐(0) 编辑
摘要: #include#define REP(i,a,b) for(int i=a;i>T;int casen=1; while(T--){ scanf("%d",&n); REP(i,0,n-1) scanf("%lld",&p[i]); REP(i,0,... 阅读全文
posted @ 2015-12-12 18:45 __560 阅读(233) 评论(0) 推荐(0) 编辑
摘要: #include#define REP(i,a,b) for(int i=a;i=(1LL>T;int casen=1; s[0]=1;REP(i,1,32) s[i]=s[i-1]*3; while(T--){ scanf("%lld%lld%lld",&k,&a,&b)... 阅读全文
posted @ 2015-12-12 17:39 __560 阅读(187) 评论(0) 推荐(0) 编辑
摘要: #include#define REP(i,a,b) for(int i=a;i=1;i--){ s+=a[i]; if(s>m){ s=a[i]; tmp[i]=1; cnt++; } ... 阅读全文
posted @ 2015-12-12 15:32 __560 阅读(354) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 9 下一页