Vika and Segments - CF610D】的更多相关文章

Vika has an infinite sheet of squared paper. Initially all squares are white. She introduced a two-dimensional coordinate system on this sheet and drew n black horizontal and vertical segments parallel to the coordinate axes. All segments have width…
D. Vika and Segments     Vika has an infinite sheet of squared paper. Initially all squares are white. She introduced a two-dimensional coordinate system on this sheet and drew n black horizontal and vertical segments parallel to the coordinate axes.…
D. Vika and Segments time limit per test:  2 seconds     memory limit per test:  256 megabytes input : standard input output:  standard output Vika has an infinite sheet of squared paper. Initially all squares are white. She introduced a two-dimensio…
D. Vika and Segments 题目连接: http://www.codeforces.com/contest/610/problem/D Description Vika has an infinite sheet of squared paper. Initially all squares are white. She introduced a two-dimensional coordinate system on this sheet and drew n black hor…
题目链接: D. Vika and Segments time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vika has an infinite sheet of squared paper. Initially all squares are white. She introduced a two-dimensional co…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Vika has an infinite sheet of squared paper. Initially all squares are white. She introduced a two-dimensional coordinate system on this sheet a…
题目链接:http://codeforces.com/contest/610/problem/D 就是给你宽度为1的n个线段,然你求总共有多少单位的长度. 相当于用线段树求面积并,只不过宽为1,注意y和x的最大都要+1,这样才相当于求面积. #include <iostream> #include <cstdio> #include <cstring> #include <map> #include <algorithm> using names…
模板题,矩形面积并 #include <iostream> #include <cstring> #include <cstdio> #include <algorithm> #define maxn 220000 #define lson l,m,rt << 1 #define rson m + 1,r,rt << 1 | 1 #define eps 1e-15 using namespace std; struct seg { d…
扫描线:http://www.cnblogs.com/scau20110726/archive/2013/04/12/3016765.html 看图,图中的数字是横坐标离散后对应的下标,计算时左端点不变,右端点加1,所以总的更新的区间是l到r-1. 也可以理解为1代表的是(1到2这一段),2代表的是(2到3这一段),3代表的是(3到4这一段)... 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #de…
可以转变成上一题(hdu1542)的形式,把每条线段变成宽为1的矩形,求矩形面积并 要注意的就是转化为右下角的点需要x+1,y-1,画一条线就能看出来了 #include<bits/stdc++.h> #define pi acos(-1.0) #define ll long long #define mod 1000000007 #define ls l,m,rt<<1 #define rs m+1,r,rt<<1|1 #pragma comment(linker,…