QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#740532#9156. 百万富翁robertfanCompile Error//C++141.2kb2024-11-13 10:20:232024-11-13 10:20:23

Judging History

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

  • [2024-11-13 10:20:23]
  • 评测
  • [2024-11-13 10:20:23]
  • 提交

answer

#include <bits/stdc++.h>
// #include "richest.h"
using namespace std;
int mp[8]={1,183,3472,20832,62500,125000,250000,500000};

int dfs(vector<int>all,int t,int s){
    if(all.size()==1){
        return all[0];
    }
    vector<int>num;
    int cnt=0;
    vector<int>ve;
    for(int i=0;i<all.size();i++){
        cnt++;
        num.push_back(all[i]);
        if(cnt==mp[t-1]){
            ve.push_back(dfs(num,t,s));
            num.clear();
            cnt=0;
        }
    }
    if(num.size()){
        ve.push_back(dfs(num,t-1,s));
    }
    int len=ve.size();
    if(len==1){
        return ve[0];
    }
    vector<int>a,b;
    for(int i=0;i<len;i++){
        for(int j=i+1;j<len;j++){
            a.push_back(ve[i]);
            b.push_back(ve[j]);
        }
    }
    vector<int>ok(len);
    vector<int>c=ask(a,b);
    for(int i=0;i<len;i++){
        ok[c[i]]++;
    }
    for(int i=0;i<len;i++){
        if(ok[i]==len-1){
            return ve[i];
        }
    }
    return 1;
}
int richest(int N,int T,int S){
    vector<int>all;
    for(int i=1;i<=N;i++){
        all.push_back(i);
    }
    return dfs(all,T,S);
}

Details

answer.code: In function ‘int dfs(std::vector<int>, int, int)’:
answer.code:37:18: error: ‘ask’ was not declared in this scope
   37 |     vector<int>c=ask(a,b);
      |                  ^~~