QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#498660#9156. 百万富翁sunrise20480 136ms67376kbC++141.6kb2024-07-30 17:22:002024-07-30 17:22:01

Judging History

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

  • [2024-07-30 17:22:01]
  • 评测
  • 测评结果:0
  • 用时:136ms
  • 内存:67376kb
  • [2024-07-30 17:22:00]
  • 提交

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]);
            }
            cn[v[i]]=0;
        }
    }
    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]);
            }
            cn[v[i]]=0;
        }
    }
    v=as;
}
int richest(int n,int t,int s){
    v.clear();
    for(int i=0;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: 2ms
memory: 10188kb

input:

1000 1 499500 957319859

output:

Too many queries
1294109832092195181
0.000000
6906350380861515327

result:

points 0.0 Too many queries

Pretest #2:

score: 0
Wrong Answer
time: 133ms
memory: 67248kb

input:

1000000 20 2000000 29091473

output:

Too many queries
1294109832092195181
0.000000
6906350380861515327

result:

points 0.0 Too many queries


Final Tests

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 10188kb

input:

1000 1 499500 957319857

output:

Too many queries
1294109832092195181
0.000000
6906350380861515327

result:

points 0.0 Too many queries

Test #2:

score: 0
Wrong Answer
time: 136ms
memory: 67376kb

input:

1000000 20 2000000 29091471

output:

Too many queries
1294109832092195181
0.000000
6906350380861515327

result:

points 0.0 Too many queries