Codeforces 1196C. Robot Breakout
维护合法区域的四个边 $xa,ya,xb,yb$
表示在以 $(xa,ya)$ 为左下角,以 $(xb,yb)$ 为右上角的矩形内的点都是合法答案
对于一个起点 $(x,y)$,如果没法往左,那么 $xa$ 就不能小于 $x$ ,如果没法往右,那么 $xb$ 就不能大于 $x$
反之可以,十分显然
对于 $y$ 也是同样的讨论一下即可
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
inline int read()
{
int x=,f=; char ch=getchar();
while(ch<''||ch>'') { if(ch=='-') f=-; ch=getchar(); }
while(ch>=''&&ch<='') { x=(x<<)+(x<<)+(ch^); ch=getchar(); }
return x*f;
}
const int N=2e5+;
int Q,n;
int main()
{
Q=read();
while(Q--)
{
n=read(); int xa,ya,xb=-,yb=-,xc=,yc=;
for(int i=;i<=n;i++)
{
xa=read(),ya=read();
if(!read()) xb=max(xb,xa);
if(!read()) yc=min(yc,ya);
if(!read()) xc=min(xc,xa);
if(!read()) yb=max(yb,ya);
}
if(xb>xc||yb>yc) { printf("0\n"); continue; }
printf("1 %d %d\n",xb,yb);
}
return ;
}
Codeforces 1196C. Robot Breakout的更多相关文章
- Codeforces Round #575 (Div. 3) C. Robot Breakout (模拟,实现)
C. Robot Breakout time limit per test3 seconds memory limit per test256 megabytes inputstandard inpu ...
- 575 div 3 C. Robot Breakout
C. Robot Breakout 题目大意: 一堆机器人,已知他们的初始位置(x,y),本来都可以向四个方向移动,但是一些原因,一个机器人的不能向某些方向移动,该方向能移动用1表示,否则用0 求他们 ...
- Codeforces Round #575 (Div. 3) B. Odd Sum Segments 、C Robot Breakout
传送门 B题题意: 给你n个数,让你把这n个数分成k个段(不能随意调动元素位置).你需要保证这k个段里面所有元素加起来的和是一个奇数.问可不可以这样划分成功.如果可以打印YES,之后打印出来是从哪里开 ...
- Codeforces 626A Robot Sequence(模拟)
A. Robot Sequence time limit per test:2 seconds memory limit per test:256 megabytes input:standard i ...
- Codeforces 626A Robot Sequence
A. Robot Sequence time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- CodeForces - 645D Robot Rapping Results Report(拓扑排序)
While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some a ...
- CodeForces 97D. Robot in Basement
time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standa ...
- Codeforces 645D Robot Rapping Results Report【拓扑排序+二分】
题目链接: http://codeforces.com/problemset/problem/645/D 题意: 给定n个机器人的m个能力大小关系,问你至少要前几个大小关系就可以得到所有机器人的能力顺 ...
- CodeForces - 922D Robot Vacuum Cleaner (贪心)
Pushok the dog has been chasing Imp for a few hours already. Fortunately, Imp knows that Pushok is a ...
随机推荐
- Idea关于Lombok的一些问题( java: 找不到符号 符号)
22:15 Lombok Requires Annotation Processing Annotation processing seems to be disabled for the proje ...
- EBS 修改系统颜色
1)修改 配置文件: Java 色彩设计,选择相应的颜色 2)清理高速缓存 注:如果不清理缓存,则要等15分钟后才显示变成新设定的颜色
- HttpClient两种调用方式
一.参数字符串 /** * HttpClient请求接口 * @return 成功:音频字节 失败:null */ public static byte[] requestBaiduAudio(Str ...
- Coding Rules
c语言按行读取的时候,注意用fgets可以读一行,但默认会把换行符也读进去,使用scanf("%s")却不会.
- 多线程分配线程的实现方案:CountDownLatch类
需求:假如我们本地有4个文件需要解析,每个文件的内容为20万行.为了提高效率我们要创建4个线程进行处理.等4个线程处理完,要在文件日志表中记录处理状态. 一般的的解决方法是使用join,join用于让 ...
- dom4j工具对XML写入修改删除操作实现
import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.io.SAXReader; import ...
- MySQL操作符与相关函数
union(联合)union使用是关联两张表或者两个查询所查出来的数据,联合成一张表但不会出现重复数据,显示的字段必须匹配列数. select s3.id cid,s1.cityName provin ...
- 六十四:CSRF攻击与防御之系统准备之病毒网站转账实现
准备一个页面或图片,用于用户访问 一:表单方式 视图 from flask import Flask, render_template app = Flask(__name__) @app.route ...
- 数据库字段和实体类和map中对应类型
http://blog.csdn.net/sxe18652071425/article/details/46416217 地址 MySQL数据类型 JAVA数据类型 JDBC TYPE 普通变量类型 ...
- 网站集成Paypal
国际化Paypal是一个不错的选择,现在很多的app都是H5,所以网站集成即可操作了. 最方便快捷的集成方式,目前Paypal的网站收款需要企业账号,不过它最开始的老版本是可以个人账号收款的.如下是个 ...