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 ...
随机推荐
- postgres的数据库备份和恢复
备份和恢复 一条命令就可以解决很简单: 这是备份的命令: pg_dump -h 127/0.0.1 -U postgres databasename > databasename.bak 指令解 ...
- Mathematica——绘制3D图形
Plot3D Plot3D[ + y, {x, -, }, {y, -, }] ListPointPlot3D 绘制点集 ListPointPlot3D[{{, , }, {, , }}, Color ...
- java实现几种常用排序:冒泡排序
一.冒泡排序介绍 冒泡排序是我们得最多的排序方式之一,原因是简单易实现,且原理易懂.顾名思义,冒泡排序,它的排序过程就像水中的气泡一样,一个一个上浮到水面. 二.冒泡排序原理分析 三.冒泡排序代码实现 ...
- where in 的参数化查询实现
身为一名小小的程序猿,在日常开发中不可以避免的要和where in和like打交道,在大多数情况下我们传的参数不多简单做下单引号.敏感字符转义之后就直接拼进了SQL,执行查询,搞定.若有一天你不可避免 ...
- [drf]访问文档出现错误'AutoSchema' object has no attribute 'get_link'
报错 'AutoSchema' object has no attribute 'get_link' 解决 参考 REST_FRAMEWORK = { 'DEFAULT_SCHEMA_CLASS': ...
- 手动部署 Ceph Mimic 三节点
目录 文章目录 目录 前文列表 部署拓扑 存储设备拓扑 网络拓扑 基础系统环境 安装 ceph-deploy 半自动化部署工具 部署 MON 部署 Manager 部署 OSD 部署 MDS 部署 R ...
- 转: 动态加载、移除js、css文件
function loadjscssfile(filename, filetype){ if (filetype=="js"){ var fileref=document.crea ...
- flask 学习 (五)
之前照着书去做的时候经常出现一些小问题,由于对于flask核心内容还不甚了解,我觉定先从更简单的做起,再根据别的需要对搭建的网站进行扩展. 上网找了一下,发现这位http://zhanghonglun ...
- Nginx 代理TCP/UDP 端口
Nginx 在1.9版本后新增TCP/UDP 代理 Nginx默认是没有开启TCP/UDP代理.需要在编译Nginx是添加--with-stream进行开启. 编译安装Nginx tar zxf cd ...
- vue-cli3的安装使用
一.安装vue-cli3 1.全局安装vue-cli 使用命令 cnpm install -g @vue/cli . npm install -g @vue/cli.yarn global add ...