kugwzk.info
BZOJ | 酷狗的小窝
http://kugwzk.info/index.php/archives/tag/bzoj
BZOJ 4767: 两双手 dp 组合数. 决定加强马所行走的方式,更具体地,他有两双手,其中一双手能让马从(u,v)移动到(u Ax,v Ay)而另一双手能让. 马从(u,v)移动到(u Bx,v By)。 法呢 答案数可能很大,你只要告诉他们答案模(10 9 7)的值就行。 第二行四个整数Ax,Ay,Bx,By分别表示两种单步移动的方法,保证Ax*By-Ay*Bx 0. Ax , Ay , Bx , By = 500, 0 = n,Ex,Ey = 500. Include bits/stdc .h. Define REP(i,x,y) for(int i=x;i (y);i ). Define RREP(i,x,y) for(int i=x;i (y);i- ). D %d %d %d". BZOJ 1954: Pku3764 The xor-longest Path 字典树. For each test case output the xor-length of the xor-longest path. 1) now=Next[now][0]; else if(Next[now][1]!
kugwzk.info
dfs | 酷狗的小窝
http://kugwzk.info/index.php/archives/tag/dfs
Codeforces 778C. Peterson Polyglot 字典树合并. Peterson loves to learn new languages, but his favorite hobby is making new ones. Language is a set of words, and word is a sequence of lowercase Latin letters. Peterson makes new language every morning. It is difficult task to store the whole language, so Peterson have invented new data structure for storing his languages which is called broom. If there is an edge from u. To the new vertex v. Th letter from all the words of this language having length at least p.
kugwzk.info
SparseTable | 酷狗的小窝
http://kugwzk.info/index.php/archives/tag/sparsetable
SPOJ BGSHOOT - Shoot and kill 差分 ST表. The problem is about Mr.BG who is a great hunter. Today he has gone to a dense forest for hunting and killing animals. Sadly, he has only one bullet in his gun. He wants to kill as many animals as possible with only one bullet. He has already known the information of duration availability of all animals of the forest. So, he is planning to shoot at a time so that he could kill maximum animal. Input begins with an integer N. Denoting total numbers of animals. BZOJ 106...
kugwzk.info
bfs | 酷狗的小窝
http://kugwzk.info/index.php/archives/tag/bfs
ICM Technex 2017 and Codeforces Round #400 (Div. 1 Div. 2, combined)做题记录. A A Serial Killer. Include bits/stdc .h using namespace std; string s,t; int n; int main() { cin s t; cout s " " t endl; scanf("%d",&n); while(n- ){ string tmp1,tmp2;cin tmp1 tmp2; if(tmp1= s) {s=tmp2;cout s " " t endl;} else {t=tmp2;cout s " " t endl;} } }. Include bits/stdc .h. B Sherlock and his girlfriend. 2) printf("%d n",2); else puts("1"); for(int i=2;i =n 1;i ) { if(i! 2) printf(" "); printf("%d",vis[i]); } }. Tmp2) return ...
kugwzk.info
usaco | 酷狗的小窝
http://kugwzk.info/index.php/archives/tag/usaco
BZOJ 1726: [Usaco2006 Nov]Roadblocks第二短路 次短路. 贝茜所在的乡村有R(1 =R =100,000)条双向道路,每条路都联结了所有的N(1 =N =5000)个农场中的某两个。 第2R 1行: 每行包含三个用空格隔开的整数A、B和D,表示存在一条长度为 D(1 = D = 5000)的路连接农场A和农场B. 最短路 1 - 2 - 4 (长度为100 200=300). 第二短路 1 - 2 - 3 - 4 (长度为100 250 100=450). 2如果dis1[next] dis1[now] len,如果dis2[next] dis1[now] len,那么更新次短路,也就是说从now可以松弛一条次短路出来。 Vis[Next]){ vis[Next]=1;que.push(Next); } } else if(dis1[Next]= dis1[now] len& dis2[Next] dis2[now] len){ dis2[Next]=dis2[now] len; if(! Vis[Next]){ deep[Next]=deep[st] 1; par[N...
kugwzk.info
bitset | 酷狗的小窝
http://kugwzk.info/index.php/archives/tag/bitset
Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) 做题记录. A Andryusha and Socks. Include bits/stdc .h #define inf 0x3f3f3f3f #define maxn 200010 using namespace std; typedef long long ll; int n,a[maxn]; int ma[maxn]; int main() { scanf("%d",&n); int cnt=0,maxx=0; for(int i=1;i =2*n;i ){ scanf("%d",&a[i]); if(ma[a[i] = 0) {cnt ,ma[a[i] ;maxx=max(maxx,cnt);} else if(ma[a[i] = 1) {ma[a[i] - ;cnt- ;} } cout maxx endl; }https:/ www.codecademy.com/learn. Include bits/stdc .h. Include bits/stdc .h.
kugwzk.info
spfa | 酷狗的小窝
http://kugwzk.info/index.php/archives/tag/spfa
Poj 3268 Silver Cow Party spfa. One cow from each of N. 1000) conveniently numbered 1. N. Is going to attend the big cow party to be held at farm # X. A total of M. 100,000) unidirectional (one-way roads connects pairs of farms; road i. 100) units of time to traverse. Of all the cows, what is the longest amount of time a cow must spend walking to the party and back? Line 1: Three space-separated integers, respectively: N. Lines 2. M. 1 describes road i. With three space-separated integers: A. Que2empty()...
kugwzk.info
BZOJ上的USACO 第一弹 | 酷狗的小窝
http://kugwzk.info/index.php/archives/1882
1606: [Usaco2008 Dec]Hay For Sale 购买干草. 1607: [Usaco2008 Dec]Patting Heads 轻拍牛头. 1618: [Usaco2008 Nov]Buying Hay 购买干草. 1609: [Usaco2008 Feb]Eating Together麻烦的聚餐. 1679: [Usaco2005 Jan]Moo Volume 牛的呼声. 1657: [Usaco2006 Mar]Mooo 奶牛的歌声. 1631: [Usaco2007 Feb]Cow Party. 1621: [Usaco2008 Open]Roads Around The Farm分岔路口. 1634: [Usaco2007 Jan]Protecting the Flowers 护花. 1611: [Usaco2008 Feb]Meteor Shower流星雨. 1612: [Usaco2008 Jan]Cow Contest奶牛的比赛. 1614: [Usaco2007 Jan]Telephone Lines架设电话线. 3384: [Usaco2004 Nov]Apple...
kugwzk.info
dp | 酷狗的小窝
http://kugwzk.info/index.php/archives/tag/dp
BZOJ 4767: 两双手 dp 组合数. 决定加强马所行走的方式,更具体地,他有两双手,其中一双手能让马从(u,v)移动到(u Ax,v Ay)而另一双手能让. 马从(u,v)移动到(u Bx,v By)。 法呢 答案数可能很大,你只要告诉他们答案模(10 9 7)的值就行。 第二行四个整数Ax,Ay,Bx,By分别表示两种单步移动的方法,保证Ax*By-Ay*Bx 0. Ax , Ay , Bx , By = 500, 0 = n,Ex,Ey = 500. Include bits/stdc .h. Define REP(i,x,y) for(int i=x;i (y);i ). Define RREP(i,x,y) for(int i=x;i (y);i- ). D %d %d %d". BZOJ 3782: 上学路线 dp 组合数取模. 3 4 3 1019663265. 1 =N,M =10 10. Include bits/stdc .h. Define REP(i,x,y) for(int i=x;i (y);i ). Lld %lld %d %lld". Include bits/st...