Codeforces Round #516 (Div. 1, by Moscow Team Olympiad) C
Posted rrsb
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces Round #516 (Div. 1, by Moscow Team Olympiad) C相关的知识,希望对你有一定的参考价值。
题链
Description
和交互库交互,你给出n个点,交互库指定颜色,求一条直线分割颜色。
Sol
分别在x轴,y轴上二分即可。
Code
#include<bits/stdc++.h> #define Mid (l+r>>1) using namespace std; int n,l,r; char p1[102],p2[102],p3[102]; void work(int x,int pos,int g) { l=500000000; r=1000000000; for (int i=x;i<n;i++) { printf("%d %d ",pos,Mid); fflush(stdout); scanf("%s",p3+1); if (p2[1]==p3[1]) l=Mid; else r=Mid; } if (p1[1]==p2[1]) { if (p2[1]==p3[1]) printf("%d %d %d %d ",pos,Mid+1,pos+1,500000000); else printf("%d %d %d %d ",pos,Mid-1,pos+1,500000000); } else { if (p2[1]==p3[1]) printf("%d %d %d %d ",pos,Mid+1,pos-1,500000000); else printf("%d %d %d %d ",pos,Mid-1,pos-1,500000000); } // if (p2[1]==p1[1]) { // printf("%d %d %d %d ",pos-(!g),Mid+1,pos-(!g)+1,1000000000-Mid-1); // } else { // printf("%d %d %d %d ",pos-(!g),Mid-1,pos-(!g)+1,1000000000-Mid+1); // } exit(0); } signed main () { scanf("%d",&n); printf("0 500000000 ");fflush(stdout); scanf("%s",p1+1); l=0; r=1000000000; for (int i=1;i<n;i++) { if (Mid-l>=5&&r-Mid>=5) { printf("%d %d ",Mid,500000000); fflush(stdout); } else work(i,Mid,p1[1]==p2[1]); scanf("%s",p2+1); if (p2[1]==p1[1]) l=Mid; else r=Mid; } if (p2[1]==p1[1]) printf("%d 40000000 %d 600000000",Mid,Mid+1); else printf("%d 40000000 %d 600000000",Mid-1,Mid); fflush(stdout); }
以上是关于Codeforces Round #516 (Div. 1, by Moscow Team Olympiad) C的主要内容,如果未能解决你的问题,请参考以下文章
Codeforces Round #516 (Div. 2&&Div.1)
Codeforces Round #516 (Div. 2, by Moscow Team Olympiad)
Codeforces Round #516 (Div. 1) 题解
[Codeforces Round #516][Codeforces 1063B/1064D. Labyrinth]