E - Down or Right Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)

时间:2022-11-30 06:58:06

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 ;
}