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…
C. Robot Breakout time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output n robots have escaped from your laboratory! You have to find them as soon as possible, because these robots are experimental,…
C. Robot Breakout 题目大意: 一堆机器人,已知他们的初始位置(x,y),本来都可以向四个方向移动,但是一些原因,一个机器人的不能向某些方向移动,该方向能移动用1表示,否则用0 求他们能否到达同一点,如果能,输出这个点坐标 思路:维护四个最值,a,b,c,d a表示这群机器人能到达的左移x坐标的下界,b表示能上移y的上界,c表示右移x的上界,d表示下移y的下界 每次遇到机器人某方向不能移动,更新相应值. 最后判断上界下界的交是否非空 #include<bits/stdc++.h>…
传送门 B题题意: 给你n个数,让你把这n个数分成k个段(不能随意调动元素位置).你需要保证这k个段里面所有元素加起来的和是一个奇数.问可不可以这样划分成功.如果可以打印YES,之后打印出来是从哪里开始断开的. 否则打印出NO 题解: 加上奇数可以使和的性质改变,原来使偶数则变为奇数,奇数则变为偶数.加上一个偶数就不会有这样的变化.所以第一步就找出来有多少个奇数.因为要保证k个段的和都为奇数,所以每个段得先有一个奇数 剩下来的奇数数量如果是偶数那就不影响,这样就可以成功划分.如果是奇数那就划分不…
A. Robot Sequence time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Calvin the robot lies in an infinite rectangular grid. Calvin's source code contains a list of n commands, each either 'U'…
A. Robot Sequence time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Calvin the robot lies in an infinite rectangular grid. Calvin's source code contains a list of n commands, each either 'U'…
While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessie needs to know about programming competition results as quickly as possible. When she covers the…
time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output The Professor has lost his home robot yet again. After some thinking Professor understood that he had left the robot in the basement. The ba…
题目链接: http://codeforces.com/problemset/problem/645/D 题意: 给定n个机器人的m个能力大小关系,问你至少要前几个大小关系就可以得到所有机器人的能力顺序. 分析: 拓扑+二分. 注意最终的顺序不能缺点,先把度为0的点入队,如果度为0的点的个数大于1,则说明至少有两个点的能力大小不确定,无法继续. 代码: #include<bits/stdc++.h> using namespace std; const int maxn = 100005; v…
Pushok the dog has been chasing Imp for a few hours already. Fortunately, Imp knows that Pushok is afraid of a robot vacuum cleaner. While moving, the robot generates a string t consisting of letters 's' and 'h', that produces a lot of noise. We defi…