QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#507877#9156. 百万富翁lin1991122100 ✓2050ms102136kbC++141.2kb2024-08-06 22:21:392024-08-06 22:21:40

Judging History

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

  • [2024-08-06 22:21:40]
  • 评测
  • 测评结果:100
  • 用时:2050ms
  • 内存:102136kb
  • [2024-08-06 22:21:39]
  • 提交

answer

#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
const int N=1e6+3;
bitset<N>vis;
vector<int>work(vector<int>now,int sum){
    vector<int>q1,q2,ret;
    int len=now.size(),K=len/sum,rm=len%sum,i=0;
    for(int T=1;T<=sum-rm;++T,i+=K)
        for(int j=i;j<i+K;++j)
            for(int k=j+1;k<i+K;++k)    
                q1.push_back(now[j]),q2.push_back(now[k]);
    ++K;
    for(int T=1;T<=rm;++T,i+=K)
        for(int j=i;j<i+K;++j)
            for(int k=j+1;k<i+K;++k)    
                q1.push_back(now[j]),q2.push_back(now[k]);
    vector<int>res=ask(q1,q2);
    int sz=res.size();
    for(int i=0;i<sz;++i)
        if(res[i]==q1[i])vis[q2[i]]=1;
        else vis[q1[i]]=1;
    for(auto x:now)
        if(!vis[x])ret.push_back(x);
    return ret;
}
int richest(int n,int t,int s){
    vis.reset();
    vector<int>now;
    for(int i=0;i<n;++i)now.push_back(i);
    if(t==1){
        now=work(now,1);
        return now[0];
    }
    now=work(now,500000);
    now=work(now,250000);
    now=work(now,125000);
    now=work(now,62500);
    now=work(now,20833);
    now=work(now,3472);
    now=work(now,183);
    now=work(now,1);
    return now[0];
    return 0;
}

详细


Pretests

Pretest #1:

score: 15
Accepted
time: 621ms
memory: 22072kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2029ms
memory: 86508kb

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: 622ms
memory: 23496kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2050ms
memory: 102136kb

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