http://codeforces.com/problemset/problem/811/B 题意: 给定一个长度为 N 不重复的数字序列,然后对其进行 M 次询问. 每次询问含L,R,X三个值,问如果数字序列中的 L ~ R 位置范围内进行从小到大的排序后,原本位置为 X 的数字是否变了. 由于 N 和 M 的范围都很小(10000),甚至不用模拟排序,对于每次询问直接 L ~ R 过一遍看有多少个元素小于 X 位置的那个,如果这个计数正好等于 X-L,那么位置为 X 的那个元素自然不会变.…
题目链接: A. Complicated GCD time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output   Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that bot…
Bran and his older sister Arya are from the same house. Bran like candies so much, so Arya is going to give him some Candies. At first, Arya and Bran have 0 Candies. There are n days, at the i-th day, Arya finds ai candies in a box, that is given by…
这道题提醒我两点: 1.break时一定要检查清楚 2.字符串直接赋值一定要注意结束符,最好能用strcpy 以上是debug的惨痛教训 #include <iostream> #include <string> #include <cstring> #include <cstdlib> #include <cstdio> #include <cmath> #include <algorithm> #include <…
离线,树状数组. 数据范围好像有点小,直接暴力可以过的. 我直接上了$n,Q≤100000$的做法:只需要判断区间上比$x$小的数字有几个即可,可以对询问进行离线操作,从左到右一个一个数字插入到树状数组中. #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <algorithm> #include <vector> #…
今晚发了个蛇精病,然后CF了,第一题这好难啊,然而水题一个,暴力飘过. 链接http://codeforces.com/contest/593/problem/A: 题意比较难懂吗?傻逼百度都翻译不对,更别说我这22了,但后来还是看懂了,没办法,就这么任性. 题意是给你N个串,然后让你选这选串中的几个要求是最后有这几个串组成的串就只有最多两个不同的字符构成,并且要最长. 那么开始分析,因为就26个因为字母爆力求一下枚举不同组合就行了,然后再从所给的字串中找符合要求的字串,用maxx记录最大值,开…
A. Uncowed Forces Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/problem/A Description Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maxi…
B. Vladik and Complicated Book   time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vladik had started reading a complicated book about algorithms containing n pages. To improve understanding…
G - Brain Network (easy) Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u CodeForces 690C1 Description One particularly well-known fact about zombies is that they move and think terribly slowly. While we still don't know…
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3049    Accepted Submission(s): 2364 Problem Description You are the CEO of Nasty Hacks Inc., a company that creates small pieces of…