Codeforces Round 973 (Div. 2) C
#include <bits/stdc++.h>
using namespace std;
int T;
int n;
struct edge
{
int pre;
int nxt;
int val;
}e[110];
int cnt = 0,rt;
int temp;
int main()
{
scanf("%d",&T);
while(T--)
{
memset(e,0,sizeof(e));
int ed = 0;
cnt = 0,rt = 0;
scanf("%d",&n);
int lc = 1,rc = 1;
printf("? 0");
printf("\n");
fflush(stdout) ;
scanf("%d",&temp);
int flag = 0;
if(temp == 1)e[++cnt].val = 0,rt = cnt,e[cnt].pre = -1,e[cnt].nxt = -1;
else
{
printf("! ");
for(int i = 1;i <= n;i++)printf("1");
printf("\n");
fflush(stdout) ;
flag = 1;
}
if(flag == 1)
{
continue;
}
ed = rt;
ed = rt;
for(int k = 2;k <= n;k++)
{
if(lc == 1)
{
e[++cnt].val = 0;
e[cnt].nxt = rt;
e[cnt].pre = -1;
e[rt].pre = cnt;
printf("? 0");
for(int i = rt;i != -1;i = e[i].nxt)
printf("%d",e[i].val);
printf("\n");
fflush(stdout) ;
scanf("%d",&temp);
if(temp == 1)
{
rt = cnt;
continue;
}
else
{
e[cnt].val = 1;
printf("? 1");
for(int i = rt;i != -1;i = e[i].nxt)
printf("%d",e[i].val);
printf("\n");
fflush(stdout) ;
scanf("%d",&temp);
if(temp == 1)
{
rt = cnt;
continue;
}
else
{
lc = 0;
k--;
continue;
}
}
}
else
{
while(e[ed].nxt != -1)ed = e[ed].nxt;
e[++cnt].val = 0;
e[cnt].pre = ed;
e[cnt].nxt = -1;
e[ed].nxt = cnt;
printf("? ");
for(int i = rt;i != -1;i = e[i].nxt)
printf("%d",e[i].val);
printf("\n");
fflush(stdout) ;
scanf("%d",&temp);
if(temp == 1)
{
ed = cnt;
continue;
}
else
{
e[cnt].val = 1;
ed = cnt;
continue;
}
}
}
printf("! ");
for(int i = rt;i != -1;i = e[i].nxt)printf("%d",e[i].val);
printf("\n");
fflush(stdout) ;
}
return 0;
}
Codeforces Round 973 (Div. 2) C的更多相关文章
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- Codeforces Round #279 (Div. 2) ABCDE
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/outpu ...
- Codeforces Round #262 (Div. 2) 1003
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...
- Codeforces Round #262 (Div. 2) 1004
Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory lim ...
- Codeforces Round #371 (Div. 1)
A: 题目大意: 在一个multiset中要求支持3种操作: 1.增加一个数 2.删去一个数 3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给 ...
- Codeforces Round #268 (Div. 2) ABCD
CF469 Codeforces Round #268 (Div. 2) http://codeforces.com/contest/469 开学了,时间少,水题就不写题解了,不水的题也不写这么详细了 ...
- 贪心+模拟 Codeforces Round #288 (Div. 2) C. Anya and Ghosts
题目传送门 /* 贪心 + 模拟:首先,如果蜡烛的燃烧时间小于最少需要点燃的蜡烛数一定是-1(蜡烛是1秒点一支), num[g[i]]记录每个鬼访问时已点燃的蜡烛数,若不够,tmp为还需要的蜡烛数, ...
随机推荐
- 浅析JS构造函数
构造函数(Constructor Function)是 JavaScript 中创建对象的一种重要方式,它不仅让我们能够创建具有相似属性和方法的对象,还能充分利用 JavaScript 的原型继承机制 ...
- 《Operating Systems: Three Easy Pieces》阅读记录
OSTEP virtualization 进程 process 进程 API 进程 API 相关术语 进程状态 statu 机制:受限直接执行 进程调度:介绍 调度:多级反馈队列 MLFQ 调度:比例 ...
- CF941
A link 其实,只要有第一次,那么下次随意找一个队列里有的数加\(k-1\)个进去,加上队列里那一个删掉\(k\)个,到最后一次肯定是剩\(k-1\)个. 没有第一次,就是\(n\). 点击查看代 ...
- 【Docker】03 基础操作
[Docker 本体操作相关] 检查Docker版本: docker -v 检查Docker当前状态: systemctl status docker 停止Docker与开启Docker system ...
- PVE linux_VM 扩容分区
页面 调整磁盘大小 手动分区 fdisk -l fdisk /dev/sda 对该磁盘进行分区, 输入n并回车,n是"new"新建分区 [root@localhost ~]# fd ...
- 中国版的huggingface——始智AI-wisemodel
新闻: 始智AI-wisemodel社区正式上线,目标打造中国版"HuggingFace" 首先要知道,AI火热了7,8年了,不论是国内还是国外一直有要搞模型分享的网站,但是这东西 ...
- 国产芯片 —— 2023年龙芯最新的 3A6000 确实已经追上 2020年发布的 10代 i3酷睿 四核处理器
看新闻: https://news.cnblogs.com/n/752564/ 首先,龙芯3A6000已经有了i3酷睿10代的水平,这是十分可喜可贺的,可以说这个CPU的性能已经是国产CPU的天花板了 ...
- 几乎纯css实现弹出框
今天需要做一个弹出框,右下角提示的那种 ,看了一两个jquery的插件 总是不太满意 .一方面js内容太多,另一方面 不太好配合已经存在的样式使用.所以 就自己用css直接实现了下 效果还可以 . 上 ...
- Leetcode: 586. Customer Placing the Largest Number of Orders
题目要求如下: 给出的例子如下: 简单地说就是要找出表中订单最多客户的ID. 使用如下的代码进行实现: import pandas as pd def largest_orders(orders: p ...
- CKS考试心得分享
CKS证书 考试相关 考试报名准备 CKS考试和CKA考试一样,已经开放中国大陆的考试.但区别是CKS目前没有中文题目,考试都是英文题目,唯一区别是CKS中文考试是中文老师监考,仅此而已.因此,建议C ...