QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#603441#9156. 百万富翁Littlelu77.99996 5501ms104076kbC++141.3kb2024-10-01 16:35:412024-10-01 16:35:41

Judging History

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

  • [2024-10-01 16:35:41]
  • 评测
  • 测评结果:77.99996
  • 用时:5501ms
  • 内存:104076kb
  • [2024-10-01 16:35:41]
  • 提交

answer

#include <bits/stdc++.h>
#include "richest.h"
using namespace std;
int solve0(){
    vector<int> aska,askb,resp;
    int cnt=0;
    for(int i=0;i<1000;++i) for(int j=i+1;j<1000;++j){
        aska.push_back(i),askb.push_back(j),++cnt;
    }
    resp=ask(aska,askb);
    vector<int> out(1000),ans;
    for(int i=0;i<cnt;++i){
        if(resp[i]==aska[i]) out[askb[i]]++;
        else out[aska[i]]++;
    }
    for(int i=0;i<1000;++i) if(out[i]==0) return i;
    return -1;
}
int solve1(){
    vector<int> asks,aske;
    for(int i=0;i<1e6;++i) asks.push_back(i);
    int alea[]={2,2,2,2,2,2,3,15,348};
    for(int k:alea){
        int n=asks.size(),m;
        vector<int> aska,askb,repd;
        map<int,int> out;
        for(int i=0;i<n;++i) for(int j=i+1;j<n;++j){
            if(i/k!=j/k) break;
            aska.push_back(asks[i]),askb.push_back(asks[j]);
        }
        repd=ask(aska,askb);
        m=repd.size();
        for(int i=0;i<m;++i){
            if(repd[i]==aska[i]) out[askb[i]]++;
            else out[aska[i]]++;
        }
        aske.clear();
        for(int i=0;i<n;++i) if(out[asks[i]]==0) aske.push_back(asks[i]);
        asks=aske;
        out.clear();
    }
    return asks[0];
}
int richest(int n,int t,int s){
    if(n==1000) return solve0();
    else return solve1();
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 636ms
memory: 25372kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 63
Acceptable Answer
time: 5478ms
memory: 104076kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1096818
5287978764728913927
0.741176
16601290867448354019

result:

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


Final Tests

Test #1:

score: 15
Accepted
time: 627ms
memory: 25280kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 63
Acceptable Answer
time: 5501ms
memory: 104064kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1096818
5287978764728913927
0.741176
16601290867448354019

result:

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