随笔分类 - TC/CF等各种比赛
摘要:A 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 #define N 10000012 #def...
阅读全文
摘要:B 树形dp组合的思想。Z队长的思路。dp[i][1]表示以i为跟结点的子树向上贡献1个的方案,dp[i][0]表示以i为跟结点的子树向上贡献0个的方案.如果当前为叶子节点,dp[i][0] = 1,(颜色为1,可以断开与父节点的连接,颜色为0,不断开,方案恒为1),dp[i][1] = co[i]...
阅读全文
摘要:A 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 #define N 10000012 #def...
阅读全文
摘要:A 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 #include11 using namespace std;12 #define N 13...
阅读全文
摘要:模拟赛链接A 第一个水题要知道units digit的意思 (个位数)有一点点小繁琐。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 #defin...
阅读全文
摘要:SRM 623 DIV2 1000pt题意:给出一个最多50*50的矩阵,每个单元可能为'.'、'P'、'A','.'代表空地,你每次操作可以把一个P或者A拿到空地上,求一个最大的含有相同字符的矩形面积,最多K次操作。首先用一个数组预处理出所有矩形所包含这三种字符的数量,然后枚举每一个矩形,如果只含...
阅读全文
摘要:这几次CF都挺惨。。A没条边权设为两端点的最小点权,最后加起来。数组开小,WA一次 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 using ...
阅读全文
摘要:链接虽做出的很少,也记录下来,留着以后来补。。浙大题目质量还是很高的B并查集的一些操作,同类和不同类我是根据到根节点距离的奇偶判断的,删点是直接新加一个点,记得福大月赛也做过类似的,并差集的这类关系题目还是比较常见的,有空深究一下。 1 #include 2 #include 3 #include...
阅读全文
摘要:---恢复内容开始---A枚举l,r 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 #defin...
阅读全文
摘要:A暴力 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 #define N 101012 #def...
阅读全文
摘要:A 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 #define N 10512 #define LL long long13 #define INF 0xfffffff14 const double eps = 1e-8;15 const double pi = acos(-1.0);16 const double inf = ~0u>>2;17 char s[N];18 int
阅读全文
摘要:写份DIV2的完整题解A判断下HQ9有没有出现过 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 #define N 11212 #define LL long long13 #define INF 0xfffffff14 const double eps = 1e-8;15 const double pi = acos(-1.0);16 const double inf = ~0u>>
阅读全文
摘要:接触ACM已经两年多,认真及热情度呈现一种抛物线趋势(开口向上的)而非指数曲线形势,不知不觉在这里的时间已接近尾声,感觉有点遗憾。 用这一个多月的时间来加倍的努力准备省赛,只记得自己唯一一次特别认真的准备是去年长沙赛之前,可惜还是没能抱银归来。那时cui大神还在,虎哥还在,感觉心里充满了向前冲的劲,或许时间有点短吧,有那么2个队友与你一起奋战感觉是很好的。现在两位都不在实验室了,自己的状态感觉受到了些许影响,做什么题也没有一起讨论的,想到比赛更是不知道怎么面对,有时会看到别人的博客,三人一起不顾时间的刷题,每天谈的也是题,真的很羡慕。但现在听到的越来越多的话是与题目无关的,与ACM无关的...
阅读全文
摘要:以为是组合,后来看着像数位dp,又不知道怎么让它不重复用。。然后就没思路 了。其实状压就可以了 状压是可以确定一个数的使用顺序的 利用01也可以确定所有的数的使用以及不重复dp[i+1《《e][(j*10+p[e])%m]+=dp[i][j]; 排下序去掉重复的 或者最后除去每个数出现的次数 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 #define N 10000012 #define L.
阅读全文
摘要:A 直接线段树过的 两遍 貌似大多是标记过的。。注意long long 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 #define LL long long 9 #define N 100100 10 LL s[N>1; 25 build(l,m,w=r) 56 { 57 if(f) 58 { 59 s[w]+=(r-l+1); 60 l...
阅读全文
摘要:A记得以前做过 当时好像没做对 就是找个子串 满足括号的匹配 []最多的开两个栈模拟 标记下就行 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 #define N 10001012 char s[N];13 char st[N];14 int sn[N][3];15 int main()16 {17 int i,k,top=0;18 cin>>s;19 k = strl...
阅读全文
摘要:A 开个数组记录一下 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 #define LL long long12 #define INF 1e1013 #define N 30001014 LL sum[N];15 int a[N];16 int pa[N];17 mapf;18 int main()19 {20 int n,i,g=0,x;21 cin>>n;22 f...
阅读全文
摘要:A: 题意:给你一个半径为n的圆 求最少阻塞多少个点 才能使所以圆内及圆上的点 都不与外边的点相连 相连是距离为1 只算整数点这题定住x,y依次递减 判断一下是否4-connect 这个意思就是 它上下左右有没有跟它相连的 圆是对称的 判断1/4圆就可以了像左边的部分图 令初始y为n 只需要判断它的左上有没有跟它连接的就可以了 如果左边有的 话 y就减一 因为说明(i+1,y)已经不在圆内了 ,这里枚举的是圆内的点有没有跟圆外的点相连接 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8.
阅读全文
摘要:Problem Statement We have balls of K different colors. The colors are numbered 0 through K-1, and the number of balls of color i is X[i]. We want to divide the balls into as few packages as possible. Each package must contain between 1 and K balls, inclusive. Additionally, each package must be eithe
阅读全文
摘要:Problem Statement Vocaloids Gumi, Ia, and Mayu love singing. They decided to make an album composed of S songs. Each of the S songs must be sung by at least one of the three Vocaloids. It is allowed for some songs to be sung by any two, or even all three Vocaloids at the same time. The number of son
阅读全文