标签:lse flush def define span amp ORC oid get
和交互库交互,你给出n个点,交互库指定颜色,求一条直线分割颜色。
分别在x轴,y轴上二分即可。
#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\n",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\n",pos,Mid+1,pos+1,500000000); else printf("%d %d %d %d\n",pos,Mid-1,pos+1,500000000); } else { if (p2[1]==p3[1]) printf("%d %d %d %d\n",pos,Mid+1,pos-1,500000000); else printf("%d %d %d %d\n",pos,Mid-1,pos-1,500000000); } // if (p2[1]==p1[1]) { // printf("%d %d %d %d\n",pos-(!g),Mid+1,pos-(!g)+1,1000000000-Mid-1); // } else { // printf("%d %d %d %d\n",pos-(!g),Mid-1,pos-(!g)+1,1000000000-Mid+1); // } exit(0); } signed main () { scanf("%d",&n); printf("0 500000000\n");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\n",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
标签:lse flush def define span amp ORC oid get
原文地址:https://www.cnblogs.com/rrsb/p/9807240.html