QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#491059#9156. 百万富翁c2023020181.999975 2117ms87384kbC++141.9kb2024-07-25 17:08:022024-07-25 17:08:03

Judging History

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

  • [2024-07-25 17:08:03]
  • 评测
  • 测评结果:81.999975
  • 用时:2117ms
  • 内存:87384kb
  • [2024-07-25 17:08:02]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>
// #include "grader.cpp"

using namespace std;

const int maxn=1e6+5;

int bg[maxn];
int f[8]={2,2,2,2,3,6,19,183};

int richest(int n,int T,int S) {
    if(T==1) {
        vector<int> a, b, c;
        for(int i=0;i<n;i++) {
            bg[i]=a.size()-1;
            for(int j=i+1;j<n;j++) {
                a.push_back(i);
                b.push_back(j);
            }
        }
        c=ask(a,b);
        int x=0;
        for(int i=1;i<n;i++) {
            if(c[bg[x]+i-x]==x) ;
            else x=i;
        }
        return x;
    }
    vector<int> vec, vec2;
    for(int i=0;i<n;i++) vec.push_back(i);
    for(int p=0;p<8;p++) {
        int v=f[p];
        n=vec.size();
        if(v==2) {
            if(n&1) vec2.push_back(vec.back()), vec.pop_back(), --n;
            vector<int> a,b,c;
            for(int i=0;i<n;i+=2) {
                a.push_back(vec[i]);
                b.push_back(vec[i+1]);
            }
            c=ask(a,b);
            vec=vec2, vec2.clear();
            for(auto x:c) vec.push_back(x);
        }else {
            vector<int> a,b,c;
            for(int i=0;i<n;i+=v) {
                int v2=min(v,n-i);
                for(int j=i;j<i+v2;j++) {
                    bg[j]=a.size()-1;
                    for(int j2=j+1;j2<i+v2;j2++) {
                        a.push_back(vec[j]);
                        b.push_back(vec[j2]);
                    }
                }
            }
            c=ask(a,b);
            for(int i=0;i<n;i+=v) {
                int v2=min(v,n-i);
                int x=i;
                for(int j=i+1;j<i+v2;j++) {
                    if(c[bg[x]+j-x]==vec[x]) ;
                    else x=j;
                }
                vec2.push_back(vec[x]);
            }
            vec=vec2, vec2.clear();
        }
    }
    return vec[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 610ms
memory: 27336kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 67
Acceptable Answer
time: 2117ms
memory: 87028kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960
2586970244946203279
0.788235
12006835993993373281

result:

points 0.788235 Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960


Final Tests

Test #1:

score: 15
Accepted
time: 611ms
memory: 27428kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 67
Acceptable Answer
time: 2100ms
memory: 87384kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960
2586970244946203279
0.788235
12006835993993373281

result:

points 0.788235 Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960