【交互 细节题 思维题】cf1064E. Dwarves, Hats and Extrasensory Abilities
第一次做交互真有趣……;挺好的细节思维题
This is an interactive problem.
In good old times dwarves tried to develop extrasensory abilities:
- Exactly n dwarves entered completely dark cave.
- Each dwarf received a hat — white or black. While in cave, none of the dwarves was able to see either his own hat or hats of other Dwarves.
- Dwarves went out of the cave to the meadow and sat at an arbitrary place one after the other. When a dwarf leaves the cave, he sees the colors of all hats of all dwarves that are seating on the meadow (i.e. left the cave before him). However, he is not able to see the color of his own hat and none of the dwarves can give him this information.
- The task for dwarves was to got diverged into two parts — one with dwarves with white hats and one with black hats.
After many centuries, dwarves finally managed to select the right place on the meadow without error. Will you be able to repeat their success?
You are asked to successively name n different integer points on the plane. After naming each new point you will be given its color — black or white. Your task is to ensure that the named points can be split by a line in such a way that all points of one color lie on the same side from the line and points of different colors lie on different sides. Moreover, no points can belong to the line. Also, you need to report any such line at the end of the process.
In this problem, the interactor is adaptive — the colors of the points in the tests are not fixed beforehand and the jury program can select them arbitrarily, in particular, depending on your program output.
Interaction
The first line of the standard input stream contains an integer n (1 ≤ n ≤ 30) — the number of points your program should name.
Then n times your program must print two integer coordinates x and y (0 ≤ x ≤ 109, 0 ≤ y ≤ 109). All points you print must be distinct.
In response to each coordinate pair your program will receive the string "black", if the point is black, or "white", if the point is white.
When all n points are processed, you need to print four integers x1, y1, x2 and y2 (0 ≤ x1, y1 ≤ 109, 0 ≤ x2, y2 ≤ 109) — coordinates of points (x1, y1) and (x2, y2), which form a line, which separates n points into black and white. Points (x1, y1) and (x2, y2) should not coincide.
Hacks
To hack solution use the following format. The first line must contain word "hack", the second line should contain the number n and the last line should contain the sequence of 0 and 1 — colors of points, which will be reported to the solution. Unlike the jury tests, colors of points in hacks are always fixed in advance. Of course, the hacked solution wouldn't be able to get the information about the colors in advance.
For example, the hack corresponding to sample test will look like this:
Note
In the sample input and output values are aligned only for simplicity of interpreting them chronologically. In real interaction no "extra" line breaks should appear.
The following picture illustrates the first test.
大致题意
第一象限平面的整点有黑白两色。输入给定$n$,请设计一种策略选择$n$个点,并构造一个半平面,使得这$n$个点被半平面。
题目分析
【交互 细节题 思维题】cf1064E. Dwarves, Hats and Extrasensory Abilities的更多相关文章
- cf1064E. Dwarves, Hats and Extrasensory Abilities(二分 交互)
题意 题目链接 \(n\)次操作,每次你给出一个点的坐标,系统会返回该点的颜色(黑 / 白),程序最后输出一条直线把所有黑点和白点分隔开 Sol 一个很直观的想法:首先询问\((dx, 0)\),然后 ...
- [Codeforces Round #516][Codeforces 1063C/1064E. Dwarves, Hats and Extrasensory Abilities]
题目链接:1063C - Dwarves, Hats and Extrasensory Abilities/1064E - Dwarves, Hats and Extrasensory Abiliti ...
- CodeForces 1063C. Dwarves, Hats and Extrasensory Abilities 交互
题目大意: 依次给定$n$个点的颜色,要求给定这$n$个点的坐标以及一条可以把他们分成两部分的直线 强制在线(交互) $n \leqslant 30$ 感觉自己真像一个乱搞... 我们只考虑把点放在最 ...
- CF1064 E - Dwarves, Hats and Extrasensory Abilities
题意 交互题, 本来应该是在平面上进行的. 实际上换成一条直线就可以, 其实换成在平面上更复杂一些. Solution 假设\(l\)点是黑点, \(r\)处是白点, 那么就把下一个点的位置放置在\( ...
- Codeforces #1063C Dwarves, Hats and Extrasensory Abilities
题目大意 交互题. 输出平面上的一个点的坐标,交互程序给这个点染色(白或黑). 如此重复 $n$ 次($ 1\le n \le 30$). 要求输出的 $n$ 个点各不相同,并且不论交互程序怎样给它们 ...
- Dwarves, Hats and Extrasensory Abilities Codeforces - 1063C
https://codeforces.com/contest/1063/problem/C 首先可以想到一个简单做法:先钦定这个直线的斜率k=-1,然后设直线y=-x+b 设黑点放直线上方:如果已知( ...
- Codeforces 1137D - Cooperative Game - [交互题+思维题]
题目链接:https://codeforces.com/contest/1137/problem/D 题意: 交互题. 给定如下一个有向图: 现在十个人各有一枚棋子(编号 $0 \sim 9$),在不 ...
- AT2386 Colorful Hats (乱搞题,思维题)
分情况讨论的神题... max不等于min + 1 或者不等于min,这种情况显然不存在. 如果都等于一个数 有两种情况: 互相独立,那么a[i]肯定==n-1 有相同的,那么a[i]一定不是独立的. ...
- 【思维题 细节】loj#6042. 「雅礼集训 2017 Day7」跳蚤王国的宰相
挂于±1的细节…… 题目描述 跳蚤王国爆发了一场动乱,国王在镇压动乱的同时,需要在跳蚤国地方钦定一个人来做宰相. 由于当时形势的复杂性,很多跳蚤都并不想去做一个傀儡宰相,带着宰相的帽子,最后还冒着被打 ...
随机推荐
- 图像分类丨Inception家族进化史「GoogleNet、Inception、Xception」
引言 Google提出的Inception系列是分类任务中的代表性工作,不同于VGG简单地堆叠卷积层,Inception重视网络的拓扑结构.本文关注Inception系列方法的演变,并加入了Xcept ...
- [USACO07JAN]平衡的阵容Balanced Lineup
[USACO07JAN]平衡的阵容Balanced Lineup 题目描述 For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) a ...
- MVC FileResult
你如何将文件传送给用户取决于你最开始如何存储它,如果你将文件存入数据库,你会用流的方式将文件返还给用户,如果你将文件存在硬盘中,你只需要提供一个超链接即可,或者也可以以流的方式.每当你需要以流的方式将 ...
- 一个很好用的侧滑框架ICSDrawerController实现的 QQ 侧滑及换肤功能
使用ICSDrawerController 实现侧滑功能 在ICSDrawerController 第三方上做了修改实现,QQ 点击头像打开关抽屉头像渐变的效果 - (void)hiddenHeadV ...
- ListView的圆角的简单实现
今天在用ListView控件的时候,发现自带的不美观,就是找找相关的美化教程,发现都挺麻烦的,无意中发现一个开源项目,地址:点击打开链接,使用起来很简单,官方网站说的也很简单,就是导入库,然后像其他控 ...
- 缓存List并写入文件持久化
LIfe is half spent before we know what is it. 缓存List并写入文件持久化 需要缓存一个List集合,比如缓存一个输入框中用户之前输入过的内容,下次当用户 ...
- 实例练习——轮播图 & 全选/全不选
1 实例1:轮播图 1)实质就是改变图片的src 2)把图片的路径用数组存起来 3) “下一张”的实现就是改变数组的下标,用一个变量i控制,每次点击下标加1.“上一张”的实现正好相反.注意“i的变化” ...
- swift 基础-4
函数:完成特定任务的代码块,通过名字来表示函数做什么 func 函数名(形参:形参类型)->返回类型 command +option+0 隐藏右边的框 //定义函数 func sayHello( ...
- 使用jQuery发送ajax
我们先看一下js的原生ajax 直接进入代码,我们先准备好servlet,之后不会改动,所以先看一下. package cn.curry.servlet; import com.alibaba.fas ...
- Google Chrome 浏览器的备用(离线)安装程序
Google Chrome 浏览器的备用(离线)安装程序(适用于 Windows) 如果您在使用 http://www.google.com/chrome 上的标准安装程序下载 Chrome 浏览器时 ...