C. Foe Pairs 题目连接: http://www.codeforces.com/contest/652/problem/C Description You are given a permutation p of length n. Also you are given m foe pairs (ai, bi) (1 ≤ ai, bi ≤ n, ai ≠ bi). Your task is to count the number of different intervals (x, y…
B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the current time in 24-hour format hh:mm. Find and print the time after a minutes. Note that you should find only the time after a minutes, see the examples t…
A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the infinite sequence of integers: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5.... The sequence is built in the following way: at first the number 1 is wr…
A. Co-prime Array 题目连接: http://www.codeforces.com/contest/660/problem/A Description You are given an array of n elements, you must make it a co-prime array in as few moves as possible. In each move you can insert any positive integral number you want…
A:Gabriel and Caterpillar 题意:蜗牛爬树问题:值得一提的是在第n天如果恰好在天黑时爬到END,则恰好整除,不用再+1: day = (End - Begin - day0)/(12*(up-down))+1; #include <iostream> #include <algorithm> #include <stdlib.h> #include <time.h> #include <cmath> #include &l…
6月快要结束了 期末也过去大半了 马上就是大三狗了 取消了小学期后20周的学期真心长, 看着各种北方的学校都放假嗨皮了,我们这个在北回归线的学校,还在忍受酷暑. 过年的时候下定决心要拿块ACM的牌子,一直坚持刷题,这一个学期刷了200道吧,感觉还是小有收获.特别是Ural和Codeforces上的题,质量很高. 然后4月的校赛,5月的省赛,发挥的也一般,不过也没有太失常. 希望暑假的选拔赛能碰到有趣的队友 蛤蛤. 这两天各种考试,实在是太忙,看了一下edu24的题目,不是很容易,做了一道水题,以…
虽然是水题但还是贴下代码把 A #include<cstring> #include<cstdio> using namespace std; ; char x[qq],y[qq]; int main() { ;,b=; char ch; while((ch=getchar())!='\n'){ ; if(ans) x[a++]=ch; } ans=; while((ch=getchar())!='\n'){ ; if(ans) y[b++]=ch; } if(a>b) pr…
A. Gabriel and Caterpillar 题目连接: http://www.codeforces.com/contest/652/problem/A Description The 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height h1 cm fro…
题目链接:http://codeforces.com/problemset/problem/652/D 给你n个不同的区间,L或者R不会出现相同的数字,问你每一个区间包含多少个区间. 我是先把每个区间看作整体,按照R从小到大排序.然后从最小的R开始枚举每个区间,要是枚举到这个区间L的时候,计算之前枚举的区间有多少个Li在L之后,那么这些Li大于L的区间的数量就是答案.那我每次枚举的时候用树状数组add(L , 1) 说明在L这个位置上出现了区间,之后枚举的时候计算L之前的和,然后i - 1 -…
题目链接:http://codeforces.com/problemset/problem/652/D 大意:给若干个线段,保证线段端点不重合,问每个线段内部包含了多少个线段. 方法是对所有线段的端点值离散化,按照左端点从大到小排序,顺着这个顺序处理所有线段,那么满足在它内部的线段一定是之前已经扫到过的.用树状数组判断有多少是在右端点范围内. #include <iostream> #include <vector> #include <algorithm> #incl…
D. Nested Segments 题目连接: http://www.codeforces.com/contest/652/problem/D Description You are given n segments on a line. There are no ends of some segments that coincide. For each segment find the number of segments it contains. Input The first line…
B. z-sort 题目连接: http://www.codeforces.com/contest/652/problem/B Description A student of z-school found a kind of sorting called z-sort. The array a with n elements are z-sorted if two conditions hold: ai ≥ ai - 1 for all even i, ai ≤ ai - 1 for all…
任意门:http://codeforces.com/contest/652/problem/D D. Nested Segments time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given n segments on a line. There are no ends of some segments th…
题目链接:http://codeforces.com/contest/652/problem/E 给你n个点m个边,x和y双向连接,要是z是1表示这条边上有宝藏,0则没有,最后给你起点和终点,问你要是到从起点到终点要是中间遇到宝藏就输出YES,否则就输出NO. 每条边只能经过一次,而且这个图保证连通的. 我用tarjan强连通缩点,把这个图变成一棵树,要是起点终点在一个连通分量里且分量里的边有宝藏,那么就输出YES.否则,就找起点到终点直接的路有没有宝藏,因为缩点之后是一棵树,所以起点和终点只有…
D. Nested Segments time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given n segments on a line. There are no ends of some segments that coincide. For each segment find the number of…
A. Gabriel and Caterpillar 题意: 就是说  一个小孩子去观察毛毛虫从 h1的地方爬到h2的地方.毛毛虫从10点爬到22点.每小时爬的距离是a, 晚上22点到第二天早上10点 毛毛虫休息 每小时下落b距离.但是最初状态是那个小孩子从14点开始观察毛毛虫的, 必须过了24点才算一天 思路:模拟.但细节地方要注意 hint:但你要知道什么情况下永远也爬不上去,就是说每小时下落比每小时上升的距离大呢,但这还有个细节, 就是即使b>a 但毛毛虫是先可以爬10个小时,如果在这10…
题意:给你若干个数对,给你一个序列,保证数对中的数都在序列中 对于这个序列,询问有多少个区间,不包含这些数对 分析:然后把这些数对转化成区间,然后对于这些区间排序,然后扫一遍,记录最靠右的左端点就好 这是一场cf edu 然后当时做的时候想都没想就树状数组了,SB了,其实不需要 #include<cstdio> #include<cstring> #include<queue> #include<cstdlib> #include<algorithm&…
B. z-sort time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A student of z-school found a kind of sorting called z-sort. The array a with n elements are z-sorted if two conditions hold: ai ≥ …
A. Cutting Banner Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/problem/A Description A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Un…
D. Weird Chess Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/problem/D Description Igor has been into chess for a long time and now he is sick of the game by the ordinary rules. He is going to think of new rules of th…
B. Quasi Binary Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/problem/B Description A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — ar…
---恢复内容开始--- output standard output The final match of the Berland Football Cup has been held recently. The referee has shown n yellow cards throughout the match. At the beginning of the match there were a_1 players in the first team and a_2 players…
A. Extract Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/600/problem/A Description You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon…
A题和B题...   A. Saitama Destroys Hotel time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to opera…
B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inv…
A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at…
司老大当时教了一种姿势枚举连续K个0,说实话当时比赛写这题完全蒙了 纵然后来知道思路还是写了一段时间 真的是.. 题目大意 n长度的序列,由0 1构成 我们可以改变 k个0为1 求可以得到的最长连续1序列的长度 既然求连续1 我们贪心连续k个0 枚举端点 左端点0设置为0 右端点0设置为 n+1 中间统计一下 最长长度和改变的0的位置就OK了 #include<cstdio> #include<map> //#include<bits/stdc++.h> #includ…
Educational Codeforces Round 17 A. k-th divisor 水题,把所有因子找出来排序然后找第\(k\)大 view code //#pragma GCC optimize("O3") //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<bits/stdc++.h> using namespace std; function<voi…
Educational Codeforces Round 37 这场有点炸,题目比较水,但只做了3题QAQ.还是实力不够啊! 写下题解算了--(写的比较粗糙,细节或者bug可以私聊2333) A. Water The Garden 题意:给你一个长度为\(n\)的池子,告诉你哪些地方一开始有水, 每秒可以向左和向右增加一格的水, 问什么时候全部充满水.(\(n \le 200\)) 题解:按题意模拟.每次进来一个水龙头,就更新所有点的答案 (取\(min\)).最 后把所有点取个\(max\)就…
Educational Codeforces Round 65 (Rated for Div. 2)题解 题目链接 A. Telephone Number 水题,代码如下: Code #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 5; int a[N] ; int n, T; char s[N] ; int main() { cin >> T; whil…