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代码对拍,结果有两份都会在某些数据上出点问题...这场的数据有点水啊_(:з」∠)_[ ...
随机推荐
- Python实现文件阅读功能(Python学习笔记)
#!/usr/bin/python# Filename: filereader.pyimport sys def readfile(filename): '''Print a file to the ...
- kotlin MutableList sort
fun MutableList<Int>.swap(index1: Int, index2: Int) {val tmp = this[index1] // 'this' correspo ...
- The 2018 ACM-ICPC China JiangSu Provincial Programming Contest(第六场)
A Plague Inc Plague Inc. is a famous game, which player develop virus to ruin the world. JSZKC wants ...
- 对OC中property的一点理解
最近在看即将要加入的项目的代码,看到一个protocol里包含着几个property.之前没有写过类似的代码,看到这里的时候,突然疑惑了一下,发现自己对property的理解好像有点模糊.所以回家后又 ...
- Passpoint R1
Passpoint R1 自从 Android 6.0 支持从网络下载包含配置文件和凭据信息的特殊文件来配置 Passpoint R1(第 1 版)凭据,Android 就一直支持 Passpoint ...
- dijkstra STL 堆优化
Code: #include<iostream> #include<algorithm> #include<vector> #include<queue> ...
- bzoj1935 [Shoi2007]园丁的烦恼
bzoj1935 [Shoi2007]园丁的烦恼 有N个点坐标为(xi,yi),M次询问,询问(a,b)-(c,d)的矩形内有多少点. 0≤n≤500000,1≤m≤500000,0≤xi,yi≤10 ...
- [NOIP2010提高组]引水入城
题目:洛谷P1514.Vijos P1777.codevs1066. 题目大意:有一个$n×m$的矩阵,每个点都有一个高度,可以在第一行的任意点建立蓄水厂.现在要把水输到最后一行的所有点上,规定水只能 ...
- sysctl---内核参数相关设置
sysctl命令被用于在内核运行时动态地修改内核的运行参数,可用的内核参数在目录/proc/sys中.它包含一些TCP/ip堆栈和虚拟内存系统的高级选项, 这可以让有经验的管理员提高引人注目的系统性能 ...
- iOS xib View宽高不能改变
IOS - xib(Interface Builder,view) - can't change view size(view不能改变大小问题) 今天在试着swift语言写个demo,,当中遇到了这个 ...