QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#537788#9156. 百万富翁kimmoqt#77.99996 2284ms101368kbC++202.0kb2024-08-30 18:21:302024-08-30 18:21:31

Judging History

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

  • [2024-08-30 18:21:31]
  • 评测
  • 测评结果:77.99996
  • 用时:2284ms
  • 内存:101368kb
  • [2024-08-30 18:21:30]
  • 提交

answer

#include "richest.h"

#include <bits/stdc++.h>
using namespace std;   

vector<int> work(vector<int> v, int b) { // returns the candidate value after one iteration
        int N=v.size();

        vector<array<int,3>> info;
        vector<int> qa,qb;
        for(int i=0;i<N;i+=b) {
                if(i+b-1<N) {
                        for(int j=0;j<b;j++) {
                                for(int k=j+1;k<b;k++) {
                                        qa.push_back(v[i+j]);
                                        qb.push_back(v[i+k]);
                                        info.push_back({i/b,i+j,i+k});
                                }
                        }
                } else {
                        int c=N-i;
                        for(int j=0;j<c;j++) {
                                for(int k=j+1;k<c;k++) {
                                        qa.push_back(v[i+j]);
                                        qb.push_back(v[i+k]);
                                        info.push_back({i/b,i+j,i+k});
                                }
                        }
                }
        }       

        vector<int> res=ask(qa,qb);

        vector<bool> rem(N);

        for(int i=0;i<info.size();i++) {
                auto [x,y,z]=info[i];
                if(res[i]==v[y]) rem[z]=1;
                else rem[y]=1;
        }

        vector<int> ans;
        for(int i=0;i<N;i++) 
                if(!rem[i]) ans.push_back(v[i]);

        assert(ans.size()==(N+b-1)/b);

        return ans;
}

int richest(int N, int T, int S) {
        vector<int> cur;
        for(int i=0;i<N;i++) cur.push_back(i);

        if(N==1000) {
                cur=work(cur,1000);
                return cur[0];
        }

        cur=work(cur,2);
        cur=work(cur,2);
        cur=work(cur,2);
        cur=work(cur,2);
        cur=work(cur,3);
        cur=work(cur,5);
        cur=work(cur,11);
        cur=work(cur,19);
        cur=work(cur,20);

        assert(cur.size()==1);
        return cur[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 640ms
memory: 29420kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 63
Acceptable Answer
time: 2284ms
memory: 101144kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1066083
13993481694678701797
0.741176
16601290867448354019

result:

points 0.741176 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1066083


Final Tests

Test #1:

score: 15
Accepted
time: 625ms
memory: 28836kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 63
Acceptable Answer
time: 2218ms
memory: 101368kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1066083
13993481694678701797
0.741176
16601290867448354019

result:

points 0.741176 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1066083