码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-08-24 17:19:21      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:for   color   pac   code   clu   mes   3.1   lse   problem   

http://codeforces.com/contest/1023/problem/E

 

交互题

 1  #include <cstdio>
 2 #include <cstdlib>
 3 #include <cmath>
 4 #include <cstring>
 5 #include <time.h>
 6 #include <string>
 7 #include <set>
 8 #include <map>
 9 #include <list>
10 #include <stack>
11 #include <queue>
12 #include <vector>
13 #include <bitset>
14 #include <ext/rope>
15 #include <algorithm>
16 #include <iostream>
17 using namespace std;
18 #define ll long long
19 #define minv 1e-6
20 #define inf 1e9
21 #define pi 3.1415926536
22 #define E  2.7182818284
23 const ll mod=1e9+7;//998244353
24 const int maxn=1e5+10;
25 
26 char S[10];
27 int s[1000],t[1000];
28 
29 int main()
30 {
31     int n,x,y,tot,xx,yy,i;
32     scanf("%d",&n);
33     x=n,y=n,tot=2*n;
34     while (x-1+y-1>=n)
35     {
36         tot--;
37         s[tot]=x;
38         t[tot]=y;
39 
40         printf("? %d %d %d %d\n",1,1,x-1,y);
41         fflush(stdout);
42         scanf("%s",S);
43         if (strcmp(S,"YES")==0)
44             x--;
45         else
46             y--;
47     }
48     tot--;
49     s[tot]=x;
50     t[tot]=y;
51 
52     xx=x,yy=y;
53 
54     tot=0;
55     x=1,y=1;
56     while (x!=xx || y!=yy)
57     {
58         tot++;
59         s[tot]=x;
60         t[tot]=y;
61 
62         printf("? %d %d %d %d\n",x,y+1,n,n);
63         fflush(stdout);
64         scanf("%s",S);
65         if (strcmp(S,"YES")==0)
66             y++;
67         else
68             x++;
69     }
70 
71     printf("! ");
72     for (i=2;i<=2*n-1;i++)
73         if (s[i]==s[i-1])
74             printf("R");
75         else
76             printf("D");
77     return 0;
78 }

 

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

标签:for   color   pac   code   clu   mes   3.1   lse   problem   

原文地址:https://www.cnblogs.com/cmyg/p/9530476.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!