QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#117190#4926. Where Is the Root?elainagreyCompile Error//C++14617b2023-06-30 16:26:132023-06-30 16:26:14

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-30 16:26:14]
  • 评测
  • [2023-06-30 16:26:13]
  • 提交

answer

// where is the root
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1; i<=n; i++)
int n,a,b,adj[510];
vector<int> v;
char S[10];
int main(){
    cin>>n;
    rep(i,n-1){
        cin>>a>>b;
        adj[a]++;adj[b]++;
    }
    rep(i,n)if(adj[i]==1)v.push_back(i);
    rep(i,n)if(adj[i]!=1)v.push_back(i);
    int s=0,e=n,mid;
    while(e-s>1){
        mid=(e+s)/2;
        cout<<"? "<<mid<<' ';
        rep(i,mid)cout<<v[i-1]<<' ';
        cout<<endl;cout.flush();
        cin>>S;
        if(S[0]=='N')s=mid;
        else e=mid;
    }
    cout<<"! "<<v[s]<<“\n”;
}

Details

answer.code:26:23: error: extended character “ is not valid in an identifier
   26 |     cout<<"! "<<v[s]<<“\n”;
      |                       ^
answer.code:26:24: error: stray ‘\’ in program
   26 |     cout<<"! "<<v[s]<<“\n”;
      |                        ^
answer.code:26:25: error: extended character ” is not valid in an identifier
   26 |     cout<<"! "<<v[s]<<“\n”;
      |                         ^
answer.code: In function ‘int main()’:
answer.code:26:23: error: ‘“’ was not declared in this scope
   26 |     cout<<"! "<<v[s]<<“\n”;
      |                       ^