QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#502435#9156. 百万富翁phlapCompile Error//C++201.4kb2024-08-03 05:43:152024-08-03 05:43:17

Judging History

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

  • [2024-08-03 05:43:17]
  • 评测
  • [2024-08-03 05:43:15]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>
using namespace std;

void thing(vector<int> &vec, int block, int n){
  vector<int> group;
  vector<int> query1, query2;
  for(int i=0; i<vec.size(); i++){
    group.push_back(vec[i]);
    if(group.size()==block){
      for(int j=0; j<block; j++){
        for(int k=0; k<j; k++){
          query1.push_back(group[j]);
          query2.push_back(group[k]);
        }
      }
      group.clear();
    }
  }
  for(int j=0; j<group.size(); j++){
    for(int k=0; k<j; k++){
      query1.push_back(group[j]);
      query2.push_back(group[k]);
    }
  }
  if(query1.empty()) return;
  int isless[n];
  memset(isless, 0, sizeof isless);
  vector<int> result=ask(query1, query2);
  for(int i=0; i<query1.size(); i++){
    if(result[i]==query1[i]) isless[query2[i]]=1;
    else isless[query1[i]]=1;
  }
  vec.clear();
  for(auto i: result) if(!isless[i]) vec.push_back(i);
  if(group.size()==1) vec.push_back(group[0]);
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

int richest(int n, int t, int S){
  vector<int> vec;
  for(int i=0; i<n; i++) vec.push_back(i);
  if(t==1){
    thing(vec, n, n);
    return vec[0];
  }
  thing(vec, 2, n);
  thing(vec, 2, n);
  thing(vec, 2, n);
  thing(vec, 2, n);
  thing(vec, 3, n);
  thing(vec, 6, n);
  thing(vec, 19, n);
s=0;
  thing(vec, 183, n);
  return vec[0];
}

Details

answer.code: In function ‘int richest(int, int, int)’:
answer.code:55:1: error: ‘s’ was not declared in this scope
   55 | s=0;
      | ^