Codefroces Educational Round 26 837 C. Two Seals
1 second
256 megabytes
standard input
standard output
One very important person has a piece of paper in the form of a rectangle a × b.
Also, he has n seals. Each seal leaves an impression on the paper in the form of a rectangle of the size xi × yi. Each impression must be parallel to the sides of the piece of paper (but seal can be rotated by 90 degrees).
A very important person wants to choose two different seals and put them two impressions. Each of the selected seals puts exactly one impression. Impressions should not overlap (but they can touch sides), and the total area occupied by them should be the largest possible. What is the largest area that can be occupied by two seals?
The first line contains three integer numbers n, a and b (1 ≤ n, a, b ≤ 100).
Each of the next n lines contain two numbers xi, yi (1 ≤ xi, yi ≤ 100).
Print the largest total area that can be occupied by two seals. If you can not select two seals, print 0.
2 2 2
1 2
2 1
4
4 10 9
2 3
1 1
5 10
9 11
56
3 10 10
6 6
7 7
20 5
0
In the first example you can rotate the second seal by 90 degrees. Then put impression of it right under the impression of the first seal. This will occupy all the piece of paper.
In the second example you can't choose the last seal because it doesn't fit. By choosing the first and the third seals you occupy the largest area.
In the third example there is no such pair of seals that they both can fit on a piece of paper.
一个大矩形内放两个矩形印章,暴力吧!
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define ios() ios::sync_with_stdio(false)
#define INF 0x3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
int n,m,k,x[],y[],ans;
int get(int x,int y,int a,int b)
{
if((x+a>n || y>m || b>m) && (y+b>m || x>n || a>n)) return ;
return x*y+a*b;
}
int main()
{
scanf("%d%d%d",&k,&n,&m);
ans=;
for(int i=;i<k;i++) scanf("%d%d",&x[i],&y[i]);
for(int i=;i<k;i++)
{
for(int j=i+;j<k;j++)
{
ans=max(ans,max(max(get(x[i],y[i],x[j],y[j]),get(y[i],x[i],x[j],y[j])),max(get(x[i],y[i],y[j],x[j]),get(y[i],x[i],y[j],x[j]))));
}
}
printf("%d\n",ans);
return ;
}
Codefroces Educational Round 26 837 C. Two Seals的更多相关文章
- Codefroces Educational Round 26 837 D. Round Subset
D. Round Subset time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...
- Codefroces Educational Round 26 837 B. Flag of Berland
B. Flag of Berland time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codefroces Educational Round 27 845G Shortest Path Problem?
Shortest Path Problem? You are given an undirected graph with weighted edges. The length of some pat ...
- Codefroces Educational Round 27 (A,B,C,D)
A. Chess Tourney time limit per test 1 second memory limit per test 256 megabytes input standard inp ...
- Educational Codeforces Round 26
Educational Codeforces Round 26 困到不行的场,等着中午显示器到了就可以美滋滋了 A. Text Volume time limit per test 1 second ...
- CodeForces 837F - Prefix Sums | Educational Codeforces Round 26
按tutorial打的我血崩,死活挂第四组- - 思路来自FXXL /* CodeForces 837F - Prefix Sums [ 二分,组合数 ] | Educational Codeforc ...
- CodeForces - 837E - Vasya's Function | Educational Codeforces Round 26
/* CodeForces - 837E - Vasya's Function [ 数论 ] | Educational Codeforces Round 26 题意: f(a, 0) = 0; f( ...
- CodeForces 837D - Round Subset | Educational Codeforces Round 26
/* CodeForces 837D - Round Subset [ DP ] | Educational Codeforces Round 26 题意: 选k个数相乘让末尾0最多 分析: 第i个数 ...
- [Educational Round 5][Codeforces 616F. Expensive Strings]
这题调得我心疲力竭...Educational Round 5就过一段时间再发了_(:з」∠)_ 先后找了三份AC代码对拍,结果有两份都会在某些数据上出点问题...这场的数据有点水啊_(:з」∠)_[ ...
随机推荐
- vue的webpack打包
一个完整的项目离不开 开发环境 生产环境 测试环境 这三个环境 首先解释一下这三个环境的含义 开发环境:开发环境是程序猿们专门用于开发的服务器,配置可以比较随意,为了开发调试方便,一般打开全部错误报告 ...
- Highcharts 前端图表插件
Highcharts 支持将图片下载成各种格式 Highcharts官网:https://www.hcharts.cn/download <div id="container" ...
- Git 内部原理 - (3) Git 引用 (4)包文件
Git 引用 我们可以借助类似于 git log 1a410e 这样的命令来浏览完整的提交历史,但为了能遍历那段历史从而找到所有相关对象,你仍须记住 1a410e 是最后一个提交. 我们需要一个文件来 ...
- [bzoj4765]普通计算姬(分块+树状数组+DFS序)
题意 给定一棵n个节点的带权树,节点编号为1到n,以root为根,设sum[p]表示以点p为根的这棵子树中所有节点的权值和.计算姬支持下列两种操作: 1 给定两个整数u,v,修改点u的权值为v. 2 ...
- NOIP2016 天天爱跑步(树上差分)
题意 给定一棵树,从时刻 0 开始,有若干人从 S[i] 出发向 T[i] 移动,每单位时刻移动一条边 对于树上每个点 x,求 w[x] 时刻有多少人恰好路过 x N,M≤300000 题解 从上午 ...
- 今日SGU 5.27
SGU 122 题意:给你n个人,每个人有大于 N / 2(向上取整)的朋友,问你1这个人有一个书,每个人都想看,只能从朋友之间传递,然后最后回到了1这个人,问你 是否有解,然后有解输出路径 收获:哈 ...
- [BJOI2018]求和(树链剖分)
题目描述 master 对树上的求和非常感兴趣.他生成了一棵有根树,并且希望多次询问这棵树上一段路径上所有节点深度的 kkk 次方和,而且每次的 kkk 可能是不同的.此处节点深度的定义是这个节点到根 ...
- ECNUOJ 2574 Principles of Compiler
Principles of Compiler Time Limit:1000MS Memory Limit:65536KBTotal Submit:473 Accepted:106 Descripti ...
- 解析XML文件之使用DOM解析器
在前面的文章中.介绍了使用SAX解析器对XML文件进行解析.SAX解析器的长处就是占用内存小.这篇文章主要介绍使用DOM解析器对XML文件进行解析. DOM解析器的长处可能是理解起来比較的直观,当然, ...
- iOS打造属于自己的用户行为统计系统
打造一款符合自己公司需求的用户行为统计系统,相信是非常多运营人员的梦想,也是开发人员对技术的的执着追求. 以下我为大家分一享下自己为公司打造的用户行为统计系统. 用户行为统计(User Beh ...