QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#469078#5206. Hot and Coldcyc001Compile Error//C++231.4kb2024-07-09 13:13:182024-07-09 13:13:18

Judging History

你现在查看的是最新测评结果

  • [2024-07-09 13:13:18]
  • 评测
  • [2024-07-09 13:13:18]
  • 提交

answer

#include<bits/stdc++.h>
#if not defined(ONLINE_JUDGE)
    std::string Ask(int,int);
#endif
#define cir(i,a,b) for(int i=a;i<b;++i)
using namespace std;

#if not defined(__GRADER_H) && defined(ONLINE_JUDGE)

#define __GRADER_H 1

extern void findTreasure();

string Ask(int x,int y){
    cerr<<"Ask:"<<x<<' '<<y<<“ Result=";
    cout<<x<<' '<<y<<'\n';
    cout.flush();
    string res;
    cin>>res;
    cerr<<res<<'\n';
    if(find(res.begin(),res.end(),'!')!=res.end()) exit(0);
    return res;
}

int main(){
    ios::sync_with_stdio(false),cin.tie(0);
    findTreasure();
    return 0;
}

#endif

static constexpr auto maxrng=(int)(1e6);

void findTreasure(){
    Ask(0,0);
    const auto strlf=Ask(1,1);
    Ask(maxrng,maxrng);
    const auto strrg=Ask(maxrng-1,maxrng-1);
    if(strlf!=strrg){
        cir(dxi,0,2) cir(dyi,0,2){
            Ask(dxi,dyi);
            Ask(maxrng-dxi,maxrng-dyi);
        }
        // abort();
    }
    const auto closer=strlf;
    cerr<<"CLOSER="<<closer<<'\n';
    auto xl=0,xr=maxrng,yl=0,yr=maxrng;
    cir(i,0,20){
        if(xl==xr&&yl==yr) break;
        const auto xmid=midpoint(xl,xr);
        const auto ymid=midpoint(yl,yr);
        Ask(xmid,ymid);
        Ask(xmid+1,ymid)==closer?xl=xmid+1:xr=xmid-1;
        Ask(xmid+1,ymid+1)==closer?yl=ymid+1:yr=ymid-1;
    }
    Ask(xl,yl);
    Ask(xl,yl+1);
    Ask(xl+1,yl);
    Ask(xl+1,yl+1);
    // abort();
}

Details

answer.code:15:30: error: extended character “ is not valid in an identifier
   15 |     cerr<<"Ask:"<<x<<' '<<y<<“ Result=";
      |                              ^
answer.code:15:39: warning: missing terminating " character
   15 |     cerr<<"Ask:"<<x<<' '<<y<<“ Result=";
      |                                       ^
answer.code:15:39: error: missing terminating " character
   15 |     cerr<<"Ask:"<<x<<' '<<y<<“ Result=";
      |                                       ^~
answer.code: In function ‘std::string Ask(int, int)’:
answer.code:15:30: error: ‘“’ was not declared in this scope
   15 |     cerr<<"Ask:"<<x<<' '<<y<<“ Result=";
      |                              ^