zoukankan      html  css  js  c++  java
  • [PA 2014]Lustra

    Description

    Byteasar公司专门外包生产带有镜子的衣柜。
    刚刚举行的招标会上,有n个工厂参加竞标。所有镜子都是长方形的,每个工厂能够制造的镜子都有其各自的最大、最小宽度和最大、最小高度。镜子不可以旋转。
    如果存在某家工厂满足这样的条件:其他所有工厂能够制造的镜子,它都能够制造。那么这家工厂显然会胜出。若不存在,评判工作将会遇到麻烦。Byteasar想知道,是否存在某家工厂符合上述条件。

    Input

    第一行有一个整数t(1<=t<=10),表示测试数据数量。
    对于每一组测试数据,第一行有一个整数n(2<=n<=100000)。接下来n行,每行有四个整数w1,w2,h1,h2(1<=w1<=w2<=10^9,1<=h1<=h2<=10^9),表示这家工厂能够制造的镜子的宽度w、高度h需要满足w1<=w<=w2,h1<=h<=h2。

    Output

    输出共有t行,每行为TAK(是)或NIE(否),表示是否存在某家工厂符合条件。

    Sample Input

    3
    3
    2 3 3 5
    1 4 2 6
    1 3 4 6
    3
    1 5 1 3
    2 4 1 3
    3 4 2 5
    4
    1 2 1 10
    1 2 3 8
    2 2 7 10
    1 2 1 10

    Sample Output

    TAK
    NIE
    TAK

    题解

    我也只能刷水题了...

     1 //It is made by Awson on 2017.10.15
     2 #include <set>
     3 #include <map>
     4 #include <cmath>
     5 #include <ctime>
     6 #include <cmath>
     7 #include <stack>
     8 #include <queue>
     9 #include <vector>
    10 #include <string>
    11 #include <cstdio>
    12 #include <cstdlib>
    13 #include <cstring>
    14 #include <iostream>
    15 #include <algorithm>
    16 #define LL long long
    17 #define Min(a, b) ((a) < (b) ? (a) : (b))
    18 #define Max(a, b) ((a) > (b) ? (a) : (b))
    19 #define sqr(x) ((x)*(x))
    20 using namespace std;
    21 const int N = 100000;
    22 const int INF = ~0u>>1;
    23 void read(int &x) {
    24     char ch; bool flag = 0;
    25     for (ch = getchar(); !isdigit(ch) && ((flag |= (ch == '-')) || 1); ch = getchar());
    26     for (x = 0; isdigit(ch); x = (x<<1)+(x<<3)+ch-48, ch = getchar());
    27     x *= 1-2*flag;
    28 }
    29 
    30 int n;
    31 int a[N+5], b[N+5], c[N+5], d[N+5];
    32 int A, B, C, D;
    33 
    34 void work() {
    35     read(n); A = C = INF; B = D = -INF;
    36     for (int i = 1; i <= n; i++) {
    37         read(a[i]); A = Min(A, a[i]);
    38         read(b[i]); B = Max(B, b[i]);
    39         read(c[i]); C = Min(C, c[i]);
    40         read(d[i]); D = Max(D, d[i]);
    41     }
    42     for (int i = 1; i <= n; i++) if (a[i] == A && b[i] == B && c[i] == C && d[i] == D) {
    43         printf("TAK
    "); return;
    44     }
    45     printf("NIE
    ");
    46 }
    47 int main() {
    48     int t; read(t);
    49     while (t--) work();
    50     return 0;
    51 }
  • 相关阅读:
    C
    大数模板
    51Nod 1040 最大公约数之和
    欧拉函数
    51Nod 1384 全排列
    B
    A
    B. Mancala (Codeforces Round #478 (Div. 2))
    I
    Requests 入门
  • 原文地址:https://www.cnblogs.com/NaVi-Awson/p/7672519.html
Copyright © 2011-2022 走看看