Codeforces 527C Glass Carving】的更多相关文章

vjudge 上题目链接:Glass Carving 题目大意: 一块 w * h 的玻璃,对其进行 n 次切割,每次切割都是垂直或者水平的,输出每次切割后最大单块玻璃的面积: 用两个 set 存储每次切割的位置,就可以比较方便的把每次切割产生和消失的长宽存下来(用个 hash 映射数组记录下对应值的长宽的数量即可,O(1) 时间维护),每次切割后剩下的最大长宽的积就是答案了: #include<cstdio> #include<cstring> #include<algor…
意甲冠军  片w*h玻璃  其n斯普利特倍  各事业部为垂直或水平  每个分割窗格区域的最大输出 用两个set存储每次分割的位置   就能够比較方便的把每次分割产生和消失的长宽存下来  每次分割后剩下的最大长宽的积就是答案了 #include <bits/stdc++.h> using namespace std; const int N = 200005; typedef long long LL; set<int>::iterator i, j; set<int>…
Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm  ×  h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lacks is understanding of what t…
原题地址:http://codeforces.com/problemset/problem/527/C Examples input H V V V output input H V V H V output 题意是给定一个矩形,不停地纵向或横向切割,问每次切割后,最大的矩形面积是多少. 最大矩形面积=最长的长*最宽的宽这题,长宽都是10^5,所以,用0 1序列表示每个点是否被切割,然后,最长的长就是长的最长连续0的数量+1最长的宽就是宽的最长连续0的数量+1于是用线段树维护最长连续零 问题转换…
数据结构维护二维平面 首先横着切与竖着切是完全没有关联的, 简单贪心,最大子矩阵的面积一定是最大长*最大宽 此处有三种做法 1.用set来维护,每次插入操作寻找这个点的前驱和后继,并维护一个计数数组,来维护最大值 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cstring> #include <set>…
题目链接:点击打开链接 题意: 给定n*m的矩阵.k个操作 2种操作: 1.H x 横向在x位置切一刀 2.V y 竖直在y位置切一刀 每次操作后输出最大的矩阵面积 思路: 由于行列是不相干的,所以仅仅要知道每次操作后行的最大间距和列的最大间距,相乘就是最大面积 用一个set维护横向的全部坐标点,一个multiset维护横向的间距. 每次对行操作x则在set中找到比x大的最小数 r 和比x小的最大数l ,操作前的间距dis = r-l.在multiset中删除dis并插入r-x 和x-l.再在s…
C. Glass Carving time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectan…
[codeforces 528]A. Glass Carving 试题描述 Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular wmm  ×  h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. Wha…
A. Glass Carving time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a re…
传送门 C. Glass Carving time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has…