BZOJ 3715: [PA2014]Lustra
来源:互联网 发布:仿模板天空 源码 编辑:程序博客网 时间:2024/05/21 16:06
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
分析
黄学长在题解中写道:
逗我
还有某大佬打算用kd tree对吧,手动@阳痿
代码
#include <bits/stdc++.h>const int N = 100005;using namespace std;int read(){ int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') {if (ch == '-') f = -1; ch = getchar();} while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();} return x * f;}int a[N],b[N],c[N],d[N];int A,B,C,D;int T,n;bool Judge(){ for (int i = 1; i <= n; i++) if (a[i] == A && b[i] == B && c[i] == C && d[i] == D) return 1; return 0;}int main(){ T = read(); while (T--) { n = read(); for (int i = 1; i <= n; i++) a[i] = read(), b[i] = read(), c[i] = read(), d[i] = read(); A = *min_element(a + 1, a + n + 1); B = *max_element(b + 1, b + n + 1); C = *min_element(c + 1, c + n + 1); D = *max_element(d + 1, d + n + 1); if (Judge()) puts("TAK"); else puts("NIE"); } return 0;}
阅读全文
0 0
- BZOJ 3715: [PA2014]Lustra
- bzoj 3715: [PA2014]Lustra 乱搞
- 3715: [PA2014]Lustra|暴力
- 【BZOJ】【P3715】【PA2014】【Lustra】【题解】【水题】
- bzoj3715 [PA2014]Lustra
- BZOJ3715 [PA2014]Lustra
- BZOJ3715: [PA2014]Lustra 水题
- bzoj3715 [PA2014]Lustra 暴力
- 【BZOJ 3714】 [PA2014]Kuglarz
- BZOJ 3711 [PA2014]Druzyny
- BZOJ 3712: [PA2014]Fiolki
- BZOJ 3709: [PA2014]Bohater
- BZOJ 3714 [PA2014]Kuglarz
- bzoj 3709 [PA2014]Bohater(贪心)
- bzoj 3712 [PA2014]Fiolki(LCA)
- BZOJ 3714 PA2014 Kuglarz Kruskal
- 【贪心】bzoj 3709:[PA2014]Bohater
- BZOJ 3713: [PA2014]Iloczyn|暴力
- VMware虚拟机三种网络模式详解 Host-Only(仅主机模式)
- 九度1029:魔咒词典(map)
- @SuppressWarnings注解
- 如何实现JDK动态代理?
- Android6.0以上获取相关权限
- BZOJ 3715: [PA2014]Lustra
- 《算法分析与设计》Week 11
- leetcode.303.Range Sum Query
- 获取屏幕宽高的三种方式
- Java8新特性函数式接口
- 前端基础笔记09
- C语言——数组,函数,指针
- POJ3253 Round Numbers + HDU2089 不要62 —— 数位DP
- hdu 2089 垃圾题目毁我青春