E. Ann and Half-Palindrome time limit per test 1.5 seconds memory limit per test 512 megabytes input standard input output standard output Tomorrow Ann takes the hardest exam of programming where she should get an excellent mark. On the last theoreti…
E. Ann and Half-Palindrome Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/problem/E Description Tomorrow Ann takes the hardest exam of programming where she should get an excellent mark. On the last theoretical class t…
A. Ilya and Diplomas 思路:水题了, 随随便便枚举一下,分情况讨论一下就OK了. code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <algorithm> #include <iostream> #include <cstring> #include <cmath> #define inf 1000000…
A. Ilya and Diplomas time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Soon a school Olympiad in Informatics will be held in Berland, n schoolchildren will participate there. At a meeting of…
D. Vitaly and Cycle Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/problem/D Description After Vitaly was expelled from the university, he became interested in the graph theory. Vitaly especially liked the cycles of an…
C. Arthur and Table Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/problem/C Description Arthur has bought a beautiful big table into his new flat. When he came home, Arthur noticed that the new table is unstable. In t…
B. Pasha and Tea Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/problem/B Description Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and…
A. Ilya and Diplomas Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/problem/A Description Soon a school Olympiad in Informatics will be held in Berland, n schoolchildren will participate there. At a meeting of the jury…
题目链接: 点这里 题目 D. Vitaly and Cycle time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output 问题描述 After Vitaly was expelled from the university, he became interested in the graph theory. Vitaly especially…
http://www.cnblogs.com/wenruo/p/4959509.html 给一个图(不一定是连通图,无重边和自环),求练成一个长度为奇数的环最小需要加几条边,和加最少边的方案数. 很容易知道连的边数只能是0,1,2,3. 如果是二分图一定不含长度为奇数的环. 难点是如果是二分图怎么求方案数呢? 二分图染色时能求出每一个联通块.在每一个联通块中把任意两个颜色相同的点连一条边即可达到要求. 如图中红色和绿色的边就是部分可行解 代码(含注释): /*******************…
我仅仅想说还好我没有放弃,还好我坚持下来了. 最终变成蓝名了,或许这对非常多人来说并不算什么.可是对于一个打了这么多场才好不easy加分的人来说,我真的有点激动. 心脏的难受或许有点是由于晚上做题时太激动了,看别人过得那么快自己也紧张了. 后来看到有非常多大神给我的建议是,刚開始学习的人,手速并非唯一重要的关键,掌握算法,一步步系统的完好它才是最重要的. 所以这一回也没有太紧张,也没有做一题看一下排名. 然后居然第一次进了前1000.rating一下子加了220多. 希望这是一个好的开端,我还想…
B. Pasha and Tea time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w millilit…
D. Vitaly and Cycle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output After Vitaly was expelled from the university, he became interested in the graph theory. Vitaly especially liked the cycl…
C. Arthur and Table time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Arthur has bought a beautiful big table into his new flat. When he came home, Arthur noticed that the new table is unstab…
[比赛链接]click here~~ [题目大意] n个人,获取一到三等文凭,每门文凭有大小范围.求最后文凭各颁发多少 [解题思路]直接枚举了, 看完题,赶紧写了一发代码,发现竟然错过注冊时间.系统提示不能提交代码.真是醉了~~.以后还是得提前注冊: A题,比較简单: 我去,昨天发的代码早上交上去竟然WA了,简直打脸-- 更新一下代码 代码: #include <iostream> #include <bits/stdc++.h> using namespace std; int…
A. Ilya and Diplomas time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Soon a school Olympiad in Informatics will be held in Berland, n schoolchildren will participate there. At a meeting of…
C. Arthur and Table time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Arthur has bought a beautiful big table into his new flat. When he came home, Arthur noticed that the new table is unstab…
题目链接:http://codeforces.com/contest/703/problem/D 思路:看了神犇的代码写的... 偶数个相同的数异或结果为0,所以区间ans[l , r]=区间[l , r]每个数相异或^区间[l , r]出现过的数相异或.如数组1,2,1,3,3,2,3,则ans[1 , 7]=(1^2^1^3^3^2^3)^(1^2^3) 前半部分可以处理出前缀异或,后半部分先对询问按r进行排序,处理过程中相同的数只保留最后一个. #include<bits/stdc++.h…
题目链接:http://codeforces.com/contest/703/problem/D 给你n个数,m次查询,每次查询问你l到r之间出现偶数次的数字xor和是多少. 我们可以先预处理前缀和Xor[i],表示1~i的xor和.因为num^num=0,所以Xor[r] ^ Xor[l - 1]求的是l~r之间出现奇数次的数字xor和. 那怎么求偶数次的呢,那我们可以先求l到r之间不重复出现数字的xor(比如1 1 2 求的是1 ^ 2),然后再xor以上求出的Xor[r] ^ Xor[l…
题目链接:http://codeforces.com/contest/474/problem/F 题意简而言之就是问你区间l到r之间有多少个数能整除区间内除了这个数的其他的数,然后区间长度减去数的个数就是答案. 要是符合条件的话,那这个数的大小一定是等于gcd(a[l]...a[r]). 我们求区间gcd的话,既可以利用线段树性质区间递归下去然后返回求解,但是每次查询是log的,所以还可以用RMQ,查询就变成O(1)了. 然后求解区间内有多少个数的大小等于gcd的话,也是利用线段树的性质,区间递…
题目链接:http://codeforces.com/problemset/problem/438/D 给你n个数,m个操作,1操作是查询l到r之间的和,2操作是将l到r之间大于等于x的数xor于x,3操作是将下标为k的数变为x. 注意成段更新的时候,遇到一个区间的最大值还小于x的话就停止更新. #include <iostream> #include <cstdio> #include <cstring> using namespace std; typedef __…
C. Day at the Beach Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/599/problem/C Description One day Squidward, Spongebob and Patrick decided to go to the beach. Unfortunately, the weather was bad, so the friends were unab…
D. The Child and Sequence Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/438/problem/D Description At the children's day, the child came to Picks's house, and messed his house up. Picks was angry at him. A lot of important…
B. "Or" Game Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/578/problem/B Description You are given n numbers a1, a2, ..., an. You can perform at most k operations. For each operation you can multiply one of the number…
题目地址:http://codeforces.com/contest/474/problem/F 由题意可知,最后能够留下来的一定是区间最小gcd. 那就转化成了该区间内与区间最小gcd数相等的个数.区间最小gcd一定小于等于区间最小值.所以仅仅要先推断最小值是否是最小gcd.若是的话,就求出最小值的个数.然后用r-l+1-个数就可以. 对于以上信息.能够用线段树来维护.分别维护区间gcd,区间最小值以及区间最小值的个数. 代码例如以下: #include <iostream> #includ…
http://codeforces.com/contest/1042/problem/D 题意 给一个数组n个元素,求有多少个连续的子序列的和<t (1<=n<=200000,abs(a[i])<=1e9) 思路 将公式转化以下,sum[r]-sum[l-1]<t 变成 sum[r]<sum[l-1]+t 可以考虑遍历每个r,先更新sum[r-1]+t,统计有多少满足条件的sum[l-1],反向树状数组维护即可 实现细节 对于每个r是更新他的sum[r-1] 因为要统计…
D. Babaei and Birthday Cake 题目连接: http://www.codeforces.com/contest/629/problem/D Description As you know, every birthday party has a cake! This time, Babaei is going to prepare the very special birthday party's cake. Simple cake is a cylinder of som…
D. Wizards and Roads 题目连接: http://www.codeforces.com/contest/167/problem/D Description In some country live wizards. They love to build cities and roads. The country used to have k cities, the j-th city (1 ≤ j ≤ k) was located at a point (xj, yj). It…
题:https://codeforces.com/contest/1099/problem/F 题意:给定一个树,每个节点有俩个信息x和t,分别表示这个节点上的饼干个数和先手吃掉这个节点上一个饼干的的时间.然后有先手和后手俩个人. ◉先手可以这么操作:在规定总时间T到达某个节点然后一定要返回根节点1,期间可以选择吃掉某些节点上的某些饼干(前提是保证剩下的时间能够回到根节点): ◉后手可以这么操作:在先手到达的位置和这个位置的孩子之间的连边选择一条让先手吃得更多的边摧毁掉,也可以跳过这个过程: 问…
D. Iahub and Xors   Iahub does not like background stories, so he'll tell you exactly what this problem asks you for. You are given a matrix a with n rows and n columns. Initially, all values of the matrix are zeros. Both rows and columns are 1-based…