传送门

维护合法区域的四个边 $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的更多相关文章

  1. Codeforces Round #575 (Div. 3) C. Robot Breakout (模拟,实现)

    C. Robot Breakout time limit per test3 seconds memory limit per test256 megabytes inputstandard inpu ...

  2. 575 div 3 C. Robot Breakout

    C. Robot Breakout 题目大意: 一堆机器人,已知他们的初始位置(x,y),本来都可以向四个方向移动,但是一些原因,一个机器人的不能向某些方向移动,该方向能移动用1表示,否则用0 求他们 ...

  3. Codeforces Round #575 (Div. 3) B. Odd Sum Segments 、C Robot Breakout

    传送门 B题题意: 给你n个数,让你把这n个数分成k个段(不能随意调动元素位置).你需要保证这k个段里面所有元素加起来的和是一个奇数.问可不可以这样划分成功.如果可以打印YES,之后打印出来是从哪里开 ...

  4. Codeforces 626A Robot Sequence(模拟)

    A. Robot Sequence time limit per test:2 seconds memory limit per test:256 megabytes input:standard i ...

  5. Codeforces 626A Robot Sequence

    A. Robot Sequence time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  6. CodeForces - 645D Robot Rapping Results Report(拓扑排序)

    While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some a ...

  7. CodeForces 97D. Robot in Basement

    time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standa ...

  8. Codeforces 645D Robot Rapping Results Report【拓扑排序+二分】

    题目链接: http://codeforces.com/problemset/problem/645/D 题意: 给定n个机器人的m个能力大小关系,问你至少要前几个大小关系就可以得到所有机器人的能力顺 ...

  9. CodeForces - 922D Robot Vacuum Cleaner (贪心)

    Pushok the dog has been chasing Imp for a few hours already. Fortunately, Imp knows that Pushok is a ...

随机推荐

  1. nagios监控部署

    nagios监控部署. 在部署之前把依赖包安装了. [root@tiandong63 ~]# yum install -y gcc glibc glibc-common php gd gd-devel ...

  2. 「CF1105E」Helping Hiasat

    题目链接 戳我 \(Solution\) 将好友访问你的主页的状态用二进制存下来 其中若第\(i\)位是\(1\),则表示这个好友在第\(i\)个\(1\)操作后访问了你的主页,否则没访问. 所以如果 ...

  3. 前端中的 Attribute & Property

    为了在翻译上显示出区别,Attribute一般被翻译为特性,Property被译为属性. 在使用上面,Angular已经表明态度 Template binding works with propert ...

  4. tp5 多条件查询

    $where['rc_category_id'] = array('eq',$cid); $where['rc_territory_ids'] = ['like', '%'.$tid.'%']; $l ...

  5. 【Azure】用“Azure Storage Exlporer”进行磁盘拷贝

    zure Storage Explorer工具的下载 Azure 存储客户端工具 https://docs.azure.cn/zh-cn/storage/storage-explorers Azure ...

  6. Python关于%matplotlib inline

    Python关于%matplotlib inline %matplotlib inline 是一个魔法函数(Magic Functions).官方给出的定义是:IPython有一组预先定义好的所谓的魔 ...

  7. [Java]手动构建表达式二叉树,求值,求后序表达式

    Inlet类,这颗二叉树是”人力运维“的: package com.hy; public class Inlet { public static void main(String[] args) th ...

  8. DP&图论 DAY 3 下午 考试

    Problem AProblem Description有一天 Tarzan 写了一篇文章,我们发现这文章当中一共出现了 n 个汉字,其中第 i 个汉字出现了 ai 次,因为 Tarzan 不希望文章 ...

  9. Struts2常量_Action配置路径_通配符

    Struts2中常用的常量 指定默认编码集,作用于HttpServletRequest的setCharacterEncoding方法 和freemarker .velocity的输出 <cons ...

  10. np.repeat()

    np.repeat()用于将numpy数组重复. numpy.repeat(a, repeats, axis=None); 参数: axis=0,沿着y轴复制,实际上增加了行数axis=1,沿着x轴复 ...