Codeforces Round #509 (Div. 2)】的更多相关文章

题目链接:http://codeforces.com/contest/1041/problem/F 题意:给出一根无限长的管子,在二维坐标上表示为y1 <= y <= y2,其中 y1 上与 n 个点,y2 上有 m 个点,问在 y1 和 y2 上各选一个点,从其中一个点出发射到另外一个点并无限反射下去,可以触碰到 y1 和 y2 上的点和最大为多少. 题解:考虑射出去的线打到对面板上所需要走的距离dd,假设出发点为0,则打在自己这边上的点的坐标为{0,2d,4d,6d,8d,...}{0,2…
题目链接:http://codeforces.com/contest/1041/problem/E 题意:给出n - 1对pair,构造一颗树,使得断开其中一条边,树两边的最大值为 a 和 b . 题解:显示最大值出现的次数为n - 1,且i点出现的次数小于等于i.一个数字 i(< n)出现的次数为 i 到 n 的距离,可构造出一条链使得满足条件. #include <bits/stdc++.h> using namespace std; #define ll long long #de…
咕咕咕了好多天终于有时间写篇博客了_(:з」∠)_ 打网赛打到自闭的一周,终于靠这场CF找回了一点信心... 1041A - Heist \(ans=max\left \{ a_i \right \}-min\left \{ a_i \right \}+1-n\) #include<bits/stdc++.h> using namespace std; #define N 1001 int n,a[N],mx,mi; int main() { mi=; scanf("%d"…
题意:给出,n和飞行员高度h,n是区间数.在区间里飞行员高度不变,其它地方每秒高度-1,x坐标+1.问在高度变为0以前,x坐标最多加多少? 用数组gap记录本区间右端到下一个区间左端的距离.用sum记录gap数组的前i项和(前缀和).其实飞行员能飞过的gap的距离之和必须小于高度h.那么对于i(表示飞行员从哪个气流的左端开始飞)从0到(n-1).用lower_bound(sum[i](第i个气流之前的gap的和)+h)查到最远的右端,再用线段树查中间的气流长度和,更新结果. 乱码: //#pra…
A:签到 #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; int read() { ,f=;char c=getchar(); ;c=getchar();} )+(x<<)+(c^),c=getchar(); ret…
There was an electronic store heist last night. All keyboards which were in the store yesterday were numbered in ascending order from some integer number x. For example, if x=4 and there were 3 keyboards in the store, then the devices had indices 4,…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输出”#Color”,如果只有”G”,”B”,”W”就输出”#Black&White”. #include <cstdio> #include <cstring> using namespace std; const int maxn = 200; const int INF =…
 cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....       其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…