CF1137D Cooperative Game 题解

Codeforces
Luogu

Description.

交互。
有一个 \(\rho\) 形的图,基环内向树,尾巴长度是 \(t\),换长是 \(c\)
\(t\)\(c\) 不知道,刚开始在尾巴一段有 \(10\) 个棋子。
每次你可以移动若干个棋子,交互器返回当前所有的在同一格子内的棋子。
最后要求所有棋子都在环“接口”处。

Solution.

神仙构造题。
\(0,1\) 一个跳 \(2\) 步一个跳 \(1\) 步。
然后跳 \(t\) 次后一个在交界处一个在后面 \(t\) 个位置。
需要再跳 \(c-t\) 后才能追上。
此时所有点再跳 \(t\) 次就都在初始位置了。

Coding.

点击查看代码
//Coded by Kamiyama_Shiki on 2021.11.19 {{{
//是啊……你就是那只鬼了……所以被你碰到以后,就轮到我变成鬼了
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;typedef long long ll;
template<typename T>inline void read(T &x)
{
	x=0;char c=getchar(),f=0;
	for(;c<48||c>57;c=getchar()) if(!(c^45)) f=1;
	for(;c>=48&&c<=57;c=getchar()) x=(x<<1)+(x<<3)+(c^48);
	f?x=-x:x;
}
template<typename T,typename...L>inline void read(T &x,L&...l) {read(x),read(l...);}//}}}
const int N=100005;
inline int ask() {int w;ll k;fflush(stdout),read(w);for(int j=1;j<=w;j++) read(k);return w;}
int main()
{
	while(1) {puts("next 0"),ask(),puts("next 0 1");if(ask()==2) break;}
	while(1) {puts("next 0 1 2 3 4 5 6 7 8 9");if(ask()==1) break;}
	return puts("done"),fflush(stdout),0;
}
posted @ 2021-11-19 14:05  Peal_Frog  阅读(56)  评论(0编辑  收藏  举报