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代码对拍,结果有两份都会在某些数据上出点问题...这场的数据有点水啊_(:з」∠)_[ ...
随机推荐
- hp服务器安装exsi5.5
启动按f8进入raid制造页面: 1. 插入exsi5.5光盘 2. 按下开机键(开机比较慢需要等待一段时间) 3. 进入启动项目界面(插入光盘后启动会让你选择启动项.选择1光盘启动) 接下来按 ...
- git 和github 关联
创建本地仓库: 查看本地仓库配置信息: 如果没有配置,则进行配置: git config --global user.name "这里换上你的用户名" git config --g ...
- Python内存分配器(如何产生一个对象的过程)
目录 内存分配器 Python分配器分层 第零层--通用的基础分配器 第一层--低级内存分配器 内存结构 arena pool new arena usable_arenas和unused_arena ...
- 使用SVN+Axure RP 8.0创建团队项目
一.使用到的工具:VisualSVN Server --SVN服务器:https://www.visualsvn.com/server/ Axure RP 8.0 :http://www.downc ...
- Java基础学习总结(23)——GUI编程
一.AWT介绍 所有的可以显示出来的图形元素都称为Component,Component代表了所有的可见的图形元素,Component里面有一种比较特殊的图形元素叫Container,Containe ...
- Vs2012在Linux开发中的应用(1):开发环境
在Linux的开发过程中使用过多个IDE.code::blocks.eclipse.source insight.还有嵌入式厂商提供的各种IDE.如VisualDsp等,感觉总是不如vs强大好用.尽管 ...
- 三:redis的List类型相关操作
</pre><pre name="code" class="php" style="font-size: 14px;"&g ...
- EBS TimeZone问题
记录问题 : http://blog.csdn.net/cymm_liu/article/details/29234919 -- Oracle 数据库中的 时间 时区 http:// ...
- 七牛用户搭建c# sdk的图文讲解
Qiniu 七牛问题解答 问题描写叙述:非常多客户属于小白类型. 可是请不要随便喷七牛的文档站.由于须要一点http的专业知识才干了解七牛的api文档.如今我给大家弄个c# sdk的搭建步骤 问题解决 ...
- 利用Eventlog Analyzer分析日志
利用EventlogAnalyzer分析日志 ManageEngineEventLogAnalyzer是一个基于Web技术.实时的事件监控管理解决方案,能够提高企业网络安全.减少工作站和服务器的宕机事 ...