QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#498659#9156. 百万富翁sunrise20480 18ms52960kbC++141.5kb2024-07-30 17:20:562024-07-30 17:21:02

Judging History

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

  • [2024-07-30 17:21:02]
  • 评测
  • 测评结果:0
  • 用时:18ms
  • 内存:52960kb
  • [2024-07-30 17:20:56]
  • 提交

answer

#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
using ll=long long;
const int f[]={500000,250000,125000,62500,20833,3472,183,1};
const int N=1e6+5;
vector<int> v;
int cn[N];
void ak(int z){
    int n=v.size();
    if(n<=z)return;
    int len1=n%z;
    int len0=z-n%z;
    vector<int> s,t;
    for(int k=0;k<len1;++k){
        int l=k*(n/z+1);
        int r=(k+1)*(n/z+1)-1;
        for(int i=l;i<=r;++i){
            for(int j=i+1;j<=r;++j){
                s.push_back(v[i]);
                t.push_back(v[j]);
            }
        }
    }
    for(int k=0;k<len0;++k){
        int l=len1*(n/z+1)+k*(n/z);
        int r=l+n/z-1;
        for(int i=l;i<=r;++i){
            for(int j=i+1;j<=r;++j){
                s.push_back(v[i]);
                t.push_back(v[j]);
            }
        }
    }
    vector<int> as=ask(s,t);
    for(int i:as)cn[i]++;
    as.clear();
    for(int k=0;k<len1;++k){
        int l=k*(n/z+1);
        int r=(k+1)*(n/z+1)-1;
        for(int i=l;i<=r;++i){
            if(cn[v[i]]==n/z){
                as.push_back(v[i]);
            }
        }
    }
    for(int k=0;k<len0;++k){
        int l=len1*(n/z+1)+k*(n/z);
        int r=l+n/z-1;
        for(int i=l;i<=r;++i){
            if(cn[v[i]]==n/z){
                as.push_back(v[i]);
            }
        }
    }
    v=as;
}
int richest(int n,int t,int s){
    v.clear();
    for(int i=1;i<=n;++i)v.push_back(i);
    int cn=0;
    while(v.size()!=1){
        ak(f[cn]);++cn;
    }
    return v[0];
}

详细


Pretests

Pretest #1:

score: 0
Wrong Answer
time: 1ms
memory: 8024kb

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: 18ms
memory: 52260kb

input:

1000000 20 2000000 29091473

output:

Index out of bounds
9775460264716263939
0.000000
6906350380861515327

result:

points 0.0 Index out of bounds


Final Tests

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 8216kb

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: 18ms
memory: 52960kb

input:

1000000 20 2000000 29091471

output:

Index out of bounds
9775460264716263939
0.000000
6906350380861515327

result:

points 0.0 Index out of bounds