QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#492779#9156. 百万富翁zwh2008100 ✓2043ms101956kbC++14834b2024-07-26 16:01:212024-07-26 16:01:21

Judging History

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

  • [2024-07-26 16:01:21]
  • 评测
  • 测评结果:100
  • 用时:2043ms
  • 内存:101956kb
  • [2024-07-26 16:01:21]
  • 提交

answer

#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
mt19937 rd(5384);
int rg(int l,int r){return rd()%(r-l+1)+l;}
int f[8]={500000,250000,125000,62500,20832,3472,183,1};
int N;
vector<int>slv(int m,vector<int>d) {
    int n=d.size(),k=n/m,r=n%m;
    vector<int>qa,qb,qc,a,del(N);
    for(int i=0,l=0;i<m;i++) {
        int R=l+k+(i<r);
        for(int j=l;j<R;j++)for(int k=j+1;k<R;k++)qa.push_back(d[j]),qb.push_back(d[k]);
        l=R;
    }
    qc=ask(qa,qb);
    for(int i=0;i<qc.size();i++)if(qa[i]==qc[i])del[qb[i]]=1;else del[qa[i]]=1;
    for(int i:d)if(!del[i])a.push_back(i);else del[i]=0;
    return a;
}
int richest(int n,int T,int S) {
    vector<int>a(N=n);
    iota(a.begin(),a.end(),0);
    if(T==1)return slv(1,a)[0];
    for(int i=0;i<8;i++)a=slv(f[i],a);
    return a[0];
}

详细


Pretests

Pretest #1:

score: 15
Accepted
time: 618ms
memory: 23188kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2043ms
memory: 101956kb

input:

1000000 20 2000000 29091473

output:

Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944
7610580723948932399
1.000000
1331569654267968081

result:

points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944


Final Tests

Test #1:

score: 15
Accepted
time: 615ms
memory: 23300kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2016ms
memory: 101724kb

input:

1000000 20 2000000 29091471

output:

Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944
7610580723948932399
1.000000
1331569654267968081

result:

points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944