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 ...
随机推荐
- Linux 下运行 class 文件
1. 基本命令 java -cp searchDir classFile -cp searchDir : 指定从该目录搜索 class 文件 classFile :类路径(不包含 .class ...
- vscode如何使用命令面板
vscode如何使用命令面板 方法/步骤 首先找到vscode. 进入,打开页面. 找到查看. 打开找到命令面板. 选择打开,可以看到命令. 下拉还有多个,以及快捷键. ...
- linux升级安装openssh时出现依赖冲突
通过如下方式下载到openssh安装包 https://www.cnblogs.com/qq931399960/p/11120429.html -rwxrwxrwx. root root Jul : ...
- stm8问题记录
sprintf 错误 现象:打印不出来数字 需要包含#include<stdio.h>
- 使用谷歌提供的SwipeRefreshLayout下拉控件进行下拉刷新的实现数据的刷新
package com.loaderman.swiperefreshdemo; import android.os.Bundle; import android.os.Handler; import ...
- vue.js 三种方式安装
Vue.js(读音 /vjuː/, 类似于 view)是一个构建数据驱动的 web 界面的渐进式框架.Vue.js 的目标是通过尽可能简单的 API 实现响应的数据绑定和组合的视图组件.它不仅易于上手 ...
- Host key verification failed
一.发现问题 问题如下图代码: 这里面,有一句很关键. ECDSA host key for 108.61.163.242 has changed and you have requested str ...
- 一个好看的测试报告模板BeautifulReport
def nrun(): report = ('report_' + ('%s') % time.strftime("%Y-%m-%d-%H-%M-%S", time.localti ...
- POJ 1182-食物链 [并查集] 《挑战程序设计竞赛》2.4
Description 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形.A吃B, B吃C,C吃A. 现有N个动物,以1-N编号.每个动物都是A,B,C中的一种,但是我们并不知道它到 ...
- Python web 项目的依赖管理工具
Poetry可以帮助你声明.管理和安装Python项目的依赖项,确保你可以在任何地方都拥有正确的堆栈. Poetry支持Python 2.7 和Python 3以上 安装 Poetry提供了一个自定义 ...