E - Down or Right Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)
http://codeforces.com/contest/1023/problem/E
交互题
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <time.h>
#include <string>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <bitset>
#include <ext/rope>
#include <algorithm>
#include <iostream>
using namespace std;
#define ll long long
#define minv 1e-6
#define inf 1e9
#define pi 3.1415926536
#define E 2.7182818284
const ll mod=1e9+;//
const int maxn=1e5+; char S[];
int s[],t[]; int main()
{
int n,x,y,tot,xx,yy,i;
scanf("%d",&n);
x=n,y=n,tot=*n;
while (x-+y->=n)
{
tot--;
s[tot]=x;
t[tot]=y; printf("? %d %d %d %d\n",,,x-,y);
fflush(stdout);
scanf("%s",S);
if (strcmp(S,"YES")==)
x--;
else
y--;
}
tot--;
s[tot]=x;
t[tot]=y; xx=x,yy=y; tot=;
x=,y=;
while (x!=xx || y!=yy)
{
tot++;
s[tot]=x;
t[tot]=y; printf("? %d %d %d %d\n",x,y+,n,n);
fflush(stdout);
scanf("%s",S);
if (strcmp(S,"YES")==)
y++;
else
x++;
} printf("! ");
for (i=;i<=*n-;i++)
if (s[i]==s[i-])
printf("R");
else
printf("D");
return ;
}
E - Down or Right Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)的更多相关文章
- Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)-D- Array Restoration
我们知道不满足的肯定是两边大中间小的,这样就用RMQ查询两个相同等值的区间内部最小值即可,注意边界条件 #include<bits/stdc++.h> #define x first #d ...
- Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)-C-Bracket Subsequence
#include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> ...
- Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)-A-Single Wildcard Pattern Matching
#include<iostream> #include<algorithm> #include<stdio.h> #include<string.h> ...
- Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) E. Down or Right
从(1,1,n,n)每次只变一个坐标,进行询问. 如果问到对角线有距离限制, 再从(1,1,n/2,n/2)询问到(n/2,n/2,n,n) 记住前半部分贪心忘上走,后本部分贪心往右走 因为最后的路线 ...
- Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)
考场上只做出了ABDE C都挂了... 题解: A 题解: 模拟 判断前面一段是否相同,后面一段是否相同,长度是否够(不能有重叠) Code: #include<stdio.h> #inc ...
- D. Recovering BST Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)
http://codeforces.com/contest/1025/problem/D 树 dp 优化 f[x][y][0]=f[x][z][1] & f[z+1][y][0] ( gcd( ...
- Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) -B C(GCD,最长连续交替序列)
B. Weakened Common Divisor time limit per test 1.5 seconds memory limit per test 256 megabytes input ...
- Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) B. Weakened Common Divis
题目链接 让你找一个数,使得这个数,可以被每个二元组的两个数中的一个数整除. 先将第一个二元组的两个数质因数分解一下,分解的质数加入set中,然后,对剩下的n-1个二元组进行遍历,每次遍历到的二元组对 ...
- Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)
A : A. Doggo Recoloring time limit per test 1 second memory limit per test 256 megabytes input stand ...
随机推荐
- python实现简单线性回归
之前推导了一元线性回归和多元线性回归,今天就用python来实现一下一元线性回归 先看下之前推导的结果 , 第一种是用循环迭代的计算方法.这里的x,y是numpy中的array类型 def su ...
- 虚拟机搭建Hadoop集群
安装包准备 操作系统:ubuntu-16.04.3-desktop-amd64.iso 软件包:VirtualBox 安装包:hadoop-3.0.0.tar.gz,jdk-8u161-linux-x ...
- java 实验一
步骤 耗时h 百分比% 需求分析 0.3h 7.5 设计 2.5h 62.5 代码实现 0.5h 12.5 测试 0,2h 5 分析总结 0.5h 12.5 实验一 截图 实验二: 实验三 实现 ...
- Task 6.2冲刺会议四 /2015-5-17
今天主要是学习并熟悉了C#的开发流程,把他的文件的大体结构和每个组件之间的联系弄清楚之后.开始写服务器部分的内容.学习过程中,感觉网上的资料有些太鱼龙混杂了,不知道该怎么取舍.明天准备完善服务器的功能 ...
- 关于map和hashmap
今天做的程序猿那题 在公司里面,程序猿经常有一堆todolist要做,而这些todolist是产品经理分配给他们的.但是当程序员遇到不懂技术的产品狗时,就悲剧了.产品经理经常修改他们的todolist ...
- 解决getOutputStream() has alerady been called for this response
在用tomcat启动一个web项目(SpringBoot)的时候报错: getOutputStream() has alerady been called for this response 但是如果 ...
- 【Leetcode】143. Reorder List
Question: Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You ...
- [学习]Windows server 使用控制台时容易卡死的解决方法
公司使用Windows server 下面的 cmd 命令行 控制台打开某一个 bat 文件的方式 进行后台使用.. 但是经常发现在winserver 2016 时 遇到卡死的情况, 今天中午我再进行 ...
- [Linux] 关于 history 命令的简单使用
1. 如果不想记录当前 会话操作的命令的话 可以使用命令 set +o history 但是这个命令有一个坏处, 他自己被记住了... 2. 还有一个办法 就是 在退出登录之前执行命令 history ...
- sql学习. case + group by 都干了啥子事情
select case pref_name when 'fudao' then 'siguo' when 'xiangchuan' then 'siguo' when 'aiyuan' then 's ...