- 博客(36)
- 收藏
- 关注
原创 可修改主席树
#include #include #include#include #define lson l,m#define rson m+1,rusing namespace std;const int N=60005;int a[N],Hash[N];int L[N<<5],R[N<<5],sum[N<<5];int S[N],T[N];int n,m,tot;struct n
2016-08-31 19:15:00 504
原创 Codeforces Round #369 (Div. 2)
我冲动的拿起了我的菜刀。。。。。MD 顺秒A加网速给力加B的翻译,以为是好运的开始。。。然后才知道,是厄运的降临。A. Bus to Udaylandtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard o
2016-08-30 19:14:08 475
原创 初学主席树
关于知识点的请看链接(我翻了n个blog,就这个写的最明白):点击打开链接代码:#include #include #include #include #define lson l, m#define rson m+1, rusing namespace std;const int N=1e5+5;int L[N<<5], R[N<<5], sum[N<<5];int t
2016-08-29 12:56:11 571
原创 Floyd判圈算法
#include #include #include int main(){ int k1=k,k2=k; int ans=k; do { k1=next(n,k1); k2=next(n,k2); if(k2>ans) ans=k2; k2=next(n,k2);
2016-08-28 11:27:57 630
原创 AIM Tech Round 3 (Div. 2)
~~~~~被隔壁拉起来打传说中的有毒场。半夜没翻译。 没网(用的手机热点)。舍友电脑没编程软件。。。还好最后涨了87分,开心!!!比赛中cha了两个,有一个给我发了消息,后来发现我俩是一个学校的。。。题解:A. Juicertime limit per test1 secondmemory limit per test256 megabytes
2016-08-25 16:16:52 352
原创 Educational Codeforces Round 16 Magic Odd Square
C. Magic Odd Squaretime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFind an n × n matrix with different numbers from
2016-08-23 21:39:01 227
原创 N阶幻方
对于n阶幻的定义和详解,请点击传送门:叫我萌萌哒的传送门。我自己写了一下代码实现,代码写的有点渣,将就看。。。。1:奇数阶void dfs(int x,int y){ if(k==n*n+1) return ; int fx=x-1>=1?x-1:n; int fy=y+1>n?1:y+1; if(a[fx][fy]==0) {
2016-08-23 21:26:40 505
原创 例题15 网络
可以交题的传送门:叫我萌萌哒的传送门。题解:想求用最少的服务器覆盖整个客户端,我们贪心的想,对于每个服务器,我们把他放在距目前最远的的客户端k位置上。更新未满足的客户端,继续这个操作。代码给出详细解释。#include#include#include #include using namespace std;const int MAXN=1010;vectorgr[MAXN],
2016-08-22 21:30:13 412
原创 Codeforces Round #368 (Div. 2)
A. Brain's Photostime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSmall, but very brave, mouse Brain was not accepted
2016-08-21 14:26:37 208
原创 bzoj 4260 Codechef REBXOR
4260: Codechef REBXOR时间限制: 10 Sec 内存限制:256 MB提交: 535 解决: 243[提交][][]题目描述输入输入数据的第一行包含一个整数N,表示数组中的元素个数。第二行包含N个整数A1,A2,…,AN。输出输出一行包含给定表达式可能的最大值。
2016-08-20 20:19:54 606
原创 HDU5536 Chip Factory(01字典树)
Chip FactoryTime Limit: 18000/9000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1643 Accepted Submission(s): 754Problem DescriptionJohn is a manag
2016-08-19 21:28:14 424
原创 01字典树模板
#include unordered_map data[30];void update(int v, int c){//v是数,c取1 -1,1为加,-1为删。 for(int i = 0; i >i] += c;}int query(int x){ int cur = 0; for(int i = 29; i >= 0; i--){ cur ^=
2016-08-14 22:46:31 711
原创 Codeforces Round #367 (Div. 2) DVasiliy's Multiset
D. Vasiliy's Multisettime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAuthor has gone out of the stories ab
2016-08-14 22:42:41 322
原创 字典树模板
typedef struct dot { bool flag;//一个单词的结尾字母 dot *next[maxn]; int v;//经过这个字母的单词有几个 }T;dot root;dot *newNode(){ dot *temp=new dot; temp->v=1; temp->flag=false; for(int i=0;i<maxn;i++)
2016-08-13 16:17:29 359
原创 HDU1075字典树初体验和map写法
其实本不想学关于字符串方面的(我对小细节处理不太好)。但是没有队友,又在某场CF遇到了,就学一下,字典树基本知识看这个:字典树基础知识这里通过这道例题HDU1075:神奇的传送门,与大家分享一下。What Are You Talking AboutTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 10240
2016-08-13 16:05:01 500
原创 Codeforces Round #367 (Div. 2)
连续两场涨分了,虽然还在基础分附近, 但还是很开心~~~~~A. Beru-taxitime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasiliy lives at poin
2016-08-12 12:37:31 367
原创 HDU2795 billboard
BillboardTime Limit: 20000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 19302 Accepted Submission(s): 8081Problem DescriptionAt the entra
2016-08-11 13:12:38 413
原创 HDU 1394 Minimum Inversion Number
Minimum Inversion NumberTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17930 Accepted Submission(s): 10891Problem Descriptio
2016-08-11 11:42:41 569
原创 从省赛回来之后到暑假集训和自己感受
省赛打的很憋屈,也很闹心。最后学校通知是三等,不过也不太高兴,省赛回来不到十天就去了北京打蓝桥杯,第一次上京,逛了挺多地方,参观了THU和PKU(我们在PKU赛点),感受了一下高考比我多200分的大神的环境,真的很好。最后蓝桥杯打铁了。。。难过一分钟,回到学校就呆着了,直到考完试,又开始ACM之路。集训我们有幸可以到HIT(兴奋脸),不过去了就蒙蔽。。学长们讲的有点快,最后还是在网上自学,只是在人
2016-08-09 23:42:43 668 2
原创 多标记处理(2)UVA 11402
题面下不出来 如果有想做的VJ查“UVA 11402 ”吧。给出题意:对一个01区间进行4种操作。1:区间值都置为1. 2:区间值都置为0. 3:区间值01呼唤。4求出区间和。题解:第一个操作可以等效成区间值*0+1.第二个操作可以等效成区间值*0.第三个操作可以等效成区间值(+1)&1。第四个操作就是线段树基本操作。此时这题转化成了上次blog写的内题类型。
2016-08-09 22:50:35 474
原创 多标记处理
Description老师交给小可可一个维护数列的任务,现在小可可希望你来帮他完成。 有长为N的数列,不妨设为a1,a2,…,aN 。有如下三种操作形式: (1)把数列中的一段数全部乘一个值; (2)把数列中的一段数全部加一个值; (3)询问数列中的一段数的和,由于答案可能很大,你只需输出这个数模P的值。Input第一行两个整数N和P(1≤P≤1000000000)
2016-08-09 15:30:12 490
原创 Codeforces Round #365 (Div. 2)D. Mishka and Interesting sum
D. Mishka and Interesting sumtime limit per test3.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Mishka enjoys programmin
2016-08-08 15:49:24 483
原创 Codeforces Round #365 (Div. 2) C题(线性约束)
C. Chris and Roadtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnd while Mishka is enjoying her trip...
2016-08-08 12:32:32 296
原创 Codeforces Round #366 (Div. 2)
A. Hulktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDr. Bruce Banner hates his enemies (like others don't). As we
2016-08-08 09:45:58 406 3
原创 BestCoder Round #86 1003(尺取法)
问题描述退役狗 NanoApe 滚回去学文化课啦!在数学课上,NanoApe 心痒痒又玩起了数列。他在纸上随便写了一个长度为 nnn 的数列,他又根据心情写下了一个数 mmm。他想知道这个数列中有多少个区间里的第 kkk 大的数不小于 mmm,当然首先这个区间必须至少要有 kkk 个数啦。输入描述第一行为一个正整数 TTT,表示数据组数。每组数据的第一行为三个整
2016-08-06 23:54:22 351
原创 线段树单标记,双标记
单标记(区间维护)#include #include #include #include #include #include #define LL long long#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define maxn 111111using namespace std;LL sum[maxn<<2];LL
2016-08-05 22:48:23 1105
原创 POJ3468 线段树区间维护
DescriptionYou have N integers, A1,A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other
2016-08-05 22:25:01 527
原创 HDU1166 模板线段树
E -单点修改Crawling in process...Crawling failedTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmitStatus DescriptionInputOutput
2016-08-05 22:08:16 321
原创 hdu 3333(树状数组,离线,离散化)
Turing TreeTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4455 Accepted Submission(s): 1561Problem DescriptionAfter invent
2016-08-05 13:28:59 462
原创 Codeforces Round #365 (Div. 2)
A. Mishka and Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMishka is a little polar bear. As known, litt
2016-08-05 10:40:43 234
原创 并查集&求指出思路为啥WA。。
动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种说法是"2 X Y",表示X吃Y。 此人对N个动物,用上述两种说法,一句接一句地
2016-08-04 22:41:42 593 2
原创 CodeForces 687C The Values You Can Make
DescriptionPari wants to buy an expensive chocolate from Arya. She hasn coins, the value of the i-th coin is ci. The price of the chocolate isk, so Pari will take a subset of her coins with
2016-08-03 21:54:20 648
原创 CodeForces 366C Dima and Salad
Dima, Inna and Seryozha have gathered in a room. That's right, someone's got to go. To cheer Seryozha up and inspire him to have a walk, Inna decided to cook something.Dima and Seryozha
2016-08-02 15:22:39 1125
原创 01 完全 多重 背包模板
void ZeroOnePack(int cost,int weight){ int v; for(v=V;v>=cost;v--) f[v]=max(f[v],f[v-cost]+weight);}void CompletePack(int cost,int weight){ int v; for(v=cost;v<=V;v++) f[v]
2016-08-02 13:38:29 443
翻译 Codeforces 148 E Porcelain dp
During her tantrums the princess usually smashes some collectable porcelain. Every furious shriek is accompanied with one item smashed.The collection of porcelain is arranged neatly on n she
2016-08-02 10:09:43 237
原创 POJ 3071 概率DP
DescriptionConsider a single-elimination football tournament involving 2n teams, denoted 1, 2, …, 2n. In each round of the tournament, all teams still in the tournament are placed in a l
2016-08-01 21:15:41 235
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人