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为还需要的蜡烛数, ...
随机推荐
- 玄机-第二章日志分析-mysql应急响应
目录 前言 简介 应急开始 准备工作 日志分析 步骤 1 步骤 2 步骤 3 步骤 4 总结 补充mysql中的/var/log/mysql/erro.log 记录上传文件信息的原因 前言 这里应急需 ...
- Docker Engine在Centos下的安装
实践环境 Centos7.8 先决条件 CentOS 7.8. 必须开启 centos-extrasyum仓库源.默认是开启的,如果关闭了,需要重新开启,如下 编辑 /etc/yum.repos.d/ ...
- 用jacoco统计JAVA项目测试代码覆盖率
一.概述 Jacoco 统计的是全量代码覆盖率.它不仅支持生成单元测试的覆盖率,也支持监控生成接口测试,功能测试的覆盖率. 在新一代精准测试技术流的影响中,各大型单位对覆盖率的追求越来越迫切.作为一款 ...
- sftp文件上传下载方法
随着信息化.数字化的发展,企业对数据安全及应用安全意识普遍加强,在数据文件传输过程中,一般建议使用sftp协议进行文件传输,sftp文件操作脚本如下: sftp操作主要有三种方式,分别是sftp客户端 ...
- 【郝斌C ST】指针 swap问题
C语言 指针 swap问题 在主函数种实现变量的交换 现在我们把这交换的行为封装进方法中 swap函数确实进行了交换,打印也是10和5了,但是下面a和b的结果还是5和10 - 形参i 和 形参j 并不 ...
- “Vanilla” 在计算机科学和技术领域中的专业翻译
"Vanilla" 在计算机科学和技术领域中通常指的是某个系统或软件的"原始"或"基础"版本,即没有任何修改.扩展或定制的版本.它可以翻译为 ...
- 台式机,华硕主板z390ws,cpu为i7-9700k 安装Ubuntu18.04系统 使用独立显卡工作 (但是显示器HDMI线缆插在主板的HDMI插槽)开机进入系统运行几分钟后自动重启,此时主板显示错误码为AMI错误
如题: 手上有这样一台新的工作站,配置为华硕主板z390ws,cpu为i7-9700k ,独立显卡为技嘉2060super, 安装Ubuntu18.04系统 . 在主板bios中进行设置(设置使用 P ...
- 【转载】 在PyTorch训练一个epoch时,模型不能接着训练,Dataloader卡死——在pytorch中尽量不要使用opencv而是使用PIL
版权声明:本文为CSDN博主「时光碎了天」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明.原文链接:https://blog.csdn.net/u013289254/ ...
- 纪念IE浏览器退役,哈哈哈!!!
网址: https://haokan.baidu.com/v?pd=wisenatural&vid=16024148879625055169 ========================= ...
- 2024全球数字经济大会:大模型时代下DataOps驱动企业数智化升级
7月5日,以"开源生态筑基础,数字经济铸未来"为主题的2024全球数字经济大会在北京成功举办,来自全国各地的专家学者.企业代表.数据库行业从业人士及众多开源开发者,共聚一堂,共同探 ...