QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#537903#9156. 百万富翁Nevll#Compile Error//C++141.1kb2024-08-30 19:36:062024-08-30 19:36:06

Judging History

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

  • [2024-08-30 19:36:06]
  • 评测
  • [2024-08-30 19:36:06]
  • 提交

answer

#include "richest.h"
# include <bits/stdc++.h>
# define ll long long
# define fi first
# define se second
# define pii pair<int, int>
using namespace std;

int richest(int N, int T, int S) {
    vector<int> nw;
    for(int i=0;i<N;i++) nw.push_back(i);

    while(nw.size() > 1) {
        vector<int> as1, as2;
        as1.clear();
        as2.clear();
        for(int i=0;i+1<nw.size();i+=2) {
            as1.push_back(nw[i]);
            as2.push_back(nw[i + 1]);
        }
        if(nw.size()%2 == 1) {
            int ls = nw.back();
            int x = as1.back(), y = as2.back();
            as1.push_back(x);
            as2.push_back(ls);
            as1.push_back(ls);
            as2.push_back(y);
        }
        nw = ask(as1, as2);
        if(ls != -1) {
            int u = nw.back();
            nw.pop_back();
            int v = nw.back();
            nw.pop_back();

            if(u == ls && v == ls) {
                nw.pop_back();
                nw.push_back(ls);
            }
        }
    }
    return nw[0];
}

Details

answer.code: In function ‘int richest(int, int, int)’:
answer.code:30:12: error: ‘ls’ was not declared in this scope; did you mean ‘ll’?
   30 |         if(ls != -1) {
      |            ^~
      |            ll