• Codefroces Educational Round 26 837 C. Two Seals


    C. Two Seals
    time limit per test
    1 second
    memory limit per test
    256 megabytes
    input
    standard input
    output
    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?

    Input

    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).

    Output

    Print the largest total area that can be occupied by two seals. If you can not select two seals, print 0.

    Examples
    Input
    2 2 2
    1 2
    2 1
    Output
    4
    Input
    4 10 9
    2 3
    1 1
    5 10
    9 11
    Output
    56
    Input
    3 10 10
    6 6
    7 7
    20 5
    Output
    0
    Note

    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[110],y[110],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 0;
        return x*y+a*b;
    }
    int main()
    {
        scanf("%d%d%d",&k,&n,&m);
        ans=0;
        for(int i=0;i<k;i++) scanf("%d%d",&x[i],&y[i]);
        for(int i=0;i<k;i++)
        {
            for(int j=i+1;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
    ",ans);
        return 0;
    }
    
    
    
    
    
  • 相关阅读:
    自定义适用于手机和平板电脑的 Dynamics 365(四):窗体脚本
    自定义适用于手机和平板电脑的 Dynamics 365(三):显示的实体
    自定义适用于手机和平板电脑的 Dynamics 365(二):窗体自定义项
    自定义适用于手机和平板电脑的 Dynamics 365(一):主页
    使用IEDA远程调试
    Apache Roller 5.0.3 XXE漏洞分析
    fastjson 反序列化漏洞笔记,比较乱
    JAVA常见安全问题复现
    Spring Integration Zip不安全解压(CVE-2018-1261)漏洞复现
    php一句话反弹bash shell
  • 原文地址:https://www.cnblogs.com/shinianhuanniyijuhaojiubujian/p/7284119.html
Copyright © 2020-2023  润新知