题解 CF1137D 【Cooperative Game】
BLOG
[Codeforces1137D]Cooperative Game
Tags:题解
题意
这是一道交互题。
给你一张下面这样的地图,由一条长为
请你输出方案,使得所有棋子走到环和链的交点处,并在走到时输出done。
你每次可以输出next a b c ...,交互库将返回k a1 a2 ... ak表示当前有
你的移动次数不能超过
题解
神仙题,一直在想
步骤:
选定两颗棋子
走了
这时(到)
然后惊奇地发现:把所有点同时走
服了服了。这场掉分掉得爽啊(第一次掉分)
代码
#include<iostream>
using namespace std;
char s[100];
int In() {int x,p;scanf("%d",&x);for(p=x;p;p--) scanf("%s",s);return x;}
int main()
{
while(1)
{
puts("next 0");fflush(stdout);In();
puts("next 0 1");fflush(stdout);
if(In()==2) break;
}
while(1)
{
puts("next 0 1 2 3 4 5 6 7 8 9");
fflush(stdout);if(In()==1) break;
}
puts("done");fflush(stdout);
}