QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#502713#9156. 百万富翁liaojiCompile Error//C++141.4kb2024-08-03 12:18:182024-08-03 12:18:18

Judging History

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

  • [2024-08-03 12:18:18]
  • 评测
  • [2024-08-03 12:18:18]
  • 提交

answer

#include"richest.h"
#include<bits/stdc++.h>
using namespace std;
const int wk[15]={0,0,15,6,3,2,2,2,2,2};

inline int Ask(vector<int>&v,int N,bool o,vector<int>&a,vector<int>&b) {
    vector<int>vis(N,0),ans;
    for(int i=0;i<N;i++)
        for(int j=i+1;j<N;j++) 
            a.push_back(v[i]),b.push_back(v[j]);
    if(o) return 0;
    ans=ask(a,b);
    int ij=0;
    for(int i=0;i<N;i++)
        for(int j=i+1;j<N;j++)
        {
            if(ans[ij]==v[i]) vis[j]=1;
            else vis[i]=1;
            ++ij;
        }
    for(int i=0;i<N;i++) if(!vis[i]) return v[i];
}

int rev[1000002];
int dfs(int N,int T,vector<int>v) {
    if(N==1) return v[0];
    if(T==1) {
        vector<int>a,b;
        return Ask(v,N,0,a,b);
    }
    vector<int>dv,a,b,ans;
    int d=wk[T];
    for(int i=0;i<N;i+=d) {
        int ed=(i+d<N?i+d:N);
        vector<int>nv(v.begin()+i,v.begin()+ed);
        Ask(nv,ed-i,1,a,b);
        rev[v[i]]=i;
    }
    vector<int>vis(N,0);
    ans=ask(a,b);
    for(int i=0;i<(int)ans.size();i++) {
        if(ans[i]==a[i]) vis[rev[b[i]]]=1;
        else vis[rev[a[i]]]=1;
    }
    for(int i=0;i<N;i++) if(!vis[i]) dv.push_back(v[i]);
    return dfs(dv.size(),T-1,dv);
}

int richest(int N,int T,int S) {
    vector<int>v(N);
    for(int i=0;i<N;i++) v[i]=i;
    if(N==1000) return dfsd(N,T,v);
    if(T>=9) return dfs(N,9,v);
}
//g++ grader.cpp richest.cpp -o richest -O2 -std=c++14 -static

Details

answer.code: In function ‘int richest(int, int, int)’:
answer.code:52:24: error: ‘dfsd’ was not declared in this scope; did you mean ‘dfs’?
   52 |     if(N==1000) return dfsd(N,T,v);
      |                        ^~~~
      |                        dfs
answer.code: In function ‘int Ask(std::vector<int>&, int, bool, std::vector<int>&, std::vector<int>&)’:
answer.code:22:1: warning: control reaches end of non-void function [-Wreturn-type]
   22 | }
      | ^