QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#537772#9156. 百万富翁kimmoqt#62.99996 2259ms101180kbC++201.9kb2024-08-30 18:09:552024-08-30 18:09:55

Judging History

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

  • [2024-08-30 18:09:55]
  • 评测
  • 测评结果:62.99996
  • 用时:2259ms
  • 内存:101180kb
  • [2024-08-30 18:09:55]
  • 提交

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);

        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: 0
Wrong Answer
time: 0ms
memory: 8108kb

input:

1000 1 499500 957319859

output:

Too many queries
1294109832092195181
0.000000
6906350380861515327

result:

points 0.0 Too many queries

Pretest #2:

score: 63
Acceptable Answer
time: 2259ms
memory: 101172kb

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: 0
Wrong Answer
time: 1ms
memory: 8076kb

input:

1000 1 499500 957319857

output:

Too many queries
1294109832092195181
0.000000
6906350380861515327

result:

points 0.0 Too many queries

Test #2:

score: 63
Acceptable Answer
time: 2220ms
memory: 101180kb

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