CF1236D Alice&Doll 题目描述 有一个机器人在一个\(n\times m\)的有\(k\)个障碍网格上移动,上北下南左西右东. 它一开始在第一行第一列,面朝东边.它在每个格子上可以右转一次或不右转,然后会向面向的方向走一步. 问能不能将所有不是障碍的格子都走恰好一遍.\(n,m,k\leq10^5\) 题解 会发现每个格只能右转一次,所以最后走出的路径大概这样: ------------------- * | * | |----------* | | *-----| | *---…
题意:给定一个n*m的网格,其中k格有障碍 周驿东从(1,1)出发面朝右,每次行动前他可以选择顺时针旋转90度或不旋转,然后向自己朝向的位置走1格 问他能否不重复不遗漏的走过所有非障碍格 n,m,k<=1e5 思路:第一次看到E的一血比D早…… 事实上就是在模拟朝右.下.左.上这样循环走,每次遇到障碍物就停下,这样一个过程 发现这个过程需要维护小于某个值的最大值和大于某个值的最小值,所以可以用set维护障碍物 参考了某红名大佬的写法,果然他们的暴力都是优雅的…… #include<bits/s…
[CF1236D] Alice and the Doll Description \(N \times M\)网格,有 \(K\) 个格子里有障碍物.每次经过一个格子的时候只能直走或者右转一次.初态在 \((1,1)\) 格子向上.求是否存在一条路径经过所有无障碍格子恰好一次. Solution 最优的走法是遇到障碍或者边界就右转,否则直走. 走过一排格子相当于挪动边界线. 这两个结论仔细品味起来很挺有深度的. 然后暴力模拟就可以了,找障碍物的过程可以用 set 优化. 这题的坐标系好像有点奇怪…
传送门 注意到每个位置只能右转一次,首先考虑如果图没有障碍那么显然要走螺旋形的 然后现在有障碍,容易发现对于某个位置如果既可以直走又可以右转,那么一定会选择直走 因为如果转了以后就一定没法走到原本直走可以走到的位置,所以必须直走 那么思路就很明确了,按这种走法然后看看走到底以后经过的总的格子数是不是等于没有障碍的格子数 但是暴力显然会 $T$ 飞 所以对每一行每一列维护一个 $vector$ ,每次走直接在 $vector$ 上二分出第一个走到的障碍,然后就可以了 实现的时候会注意到走过的位置会…
题目:http://codeforces.com/problemset/problem/1236/D思路:机器人只能按照→↓←↑这个规律移动,所以在当前方向能够前进的最远处即为界限,到达最远处右转,并且下次在该方向无法再移动到更远的地方,因此按照→↓←↑模拟即可,每次移动更新界限 ,无法移动则结束(第一次无法移动可右转,n*m会爆int)          障碍用set存,每次二分寻找能到达最远的地方,并与界限比较 #include<bits/stdc++.h> using namespace…
Alice's present Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=95030#problem/A Description As a doll master, Alice owns a wide range of dolls, and each of them has a number tip on it's back, the tip…
 Alice's present Description As a doll master, Alice owns a wide range of dolls, and each of them has a number tip on it's back, the tip can be treated as a positive integer. (the number can be repeated). One day, Alice hears that her best friend Mar…
You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the width and height of one envelope is greater than the width and height of the other envelope. What is…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5558 Problem Description Alice wants to send a classified message to Bob. She tries to encrypt the message with her original encryption method. The message is a string S, which consists of Nlowercase let…
Alice and Bob Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 147    Accepted Submission(s): 22 Problem Description As you know, Alice and Bob always play game together, and today they get a…