QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#497512#9156. 百万富翁jager590 60ms79740kbC++171.5kb2024-07-29 11:57:022024-07-29 11:57:06

Judging History

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

  • [2024-07-29 11:57:06]
  • 评测
  • 测评结果:0
  • 用时:60ms
  • 内存:79740kb
  • [2024-07-29 11:57:02]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+5;
int n,kkk[9]={1,183,3472,20833,62500,125000,250000,500000,1000000};
bool vis[N];
std::vector<int> ask(std::vector<int> a, std::vector<int> b);
int richest(int N, int T, int S) {
    n=N;
    if(T==1){
        vector<int>a,b;
        for(int i = 1;i<=n;i++){
            for(int j = i+1;j<=n;j++){
                a.push_back(i),b.push_back(j);
            }
        }
        auto c = ask(a,b);
        for(int i = 1;i<=n;i++)vis[i]=1;
        for(int i = 0;i<a.size();i++){
            if(a[i]==c[i])vis[b[i]]=0;
            else vis[a[i]]=0;
        }
        for(int i = 1;i<=n;i++)if(vis[i])return i;
    }
    vector<int>a,b,c,d,e;
    for(int i = 1;i<=n;i++)d.push_back(i),vis[i]=1;
    for(int i = 8;i>=0;i--){
        if(kkk[i] >= n)continue;
        int now = n/kkk[i],qwq=n%kkk[i],lst=d.size()-1;
        for(int j = 1,w;j<=kkk[i];j++){
            w=now + (j<=qwq);
            e.clear();
            for(int k = 1;k<=w;k++)e.push_back(d[lst--]);
            for(int x1=0;x1<e.size();x1++){
                for(int x2=x1+1;x2<e.size();x2++)a.push_back(x1),b.push_back(x2);
            }
        }
        c = ask(a,b);
        for(int j = 0;j<a.size();j++){
            if(a[j]==c[j])vis[b[j]]=0;
            else vis[a[j]]=0;
        }
        e.clear();
        for(auto j : d)if(vis[j])e.push_back(j);
        d=e;
        n=kkk[i];
    }
    return d.back();
}

详细


Pretests

Pretest #1:

score: 0
Wrong Answer
time: 0ms
memory: 16060kb

input:

1000 1 499500 957319859

output:

Index out of bounds
9775460264716263939
0.000000
6906350380861515327

result:

points 0.0 Index out of bounds

Pretest #2:

score: 0
Wrong Answer
time: 47ms
memory: 79740kb

input:

1000000 20 2000000 29091473

output:

Too many total elements in queries
1469670942222006797
0.000000
6906350380861515327

result:

points 0.0 Too many total elements in queries


Final Tests

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 15860kb

input:

1000 1 499500 957319857

output:

Index out of bounds
9775460264716263939
0.000000
6906350380861515327

result:

points 0.0 Index out of bounds

Test #2:

score: 0
Wrong Answer
time: 60ms
memory: 78828kb

input:

1000000 20 2000000 29091471

output:

Too many total elements in queries
1469670942222006797
0.000000
6906350380861515327

result:

points 0.0 Too many total elements in queries