QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#491172#9156. 百万富翁c20230201100 ✓2048ms90352kbC++141.5kb2024-07-25 17:27:022024-07-25 17:27:02

Judging History

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

  • [2024-07-25 17:27:02]
  • 评测
  • 测评结果:100
  • 用时:2048ms
  • 内存:90352kb
  • [2024-07-25 17:27: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]={500000,250000,125000,62500,20832,3472,183,1};

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++) {
        n=vec.size();
        int t=f[p], r=n%t, v=n/t;
        vector<int> a,b,c;
        int pos=0;
        for(int i=1;i<=t;i++) {
            int v2=v+(i<=r);
            for(int j=pos;j<pos+v2;j++) {
                bg[j]=a.size()-1;
                for(int j2=j+1;j2<pos+v2;j2++) {
                    a.push_back(vec[j]);
                    b.push_back(vec[j2]);
                }
            }
            pos+= v2;
        }
        c=ask(a,b);
        pos=0;
        for(int i=1;i<=t;i++) {
            int v2=v+(i<=r);
            int x=pos;
            for(int j=pos+1;j<pos+v2;j++) {
                if(c[bg[x]+j-x]==vec[x]) ;
                else x=j;
            }
            vec2.push_back(vec[x]);
            pos+= v2;
        }
        vec=vec2, vec2.clear();
    }
    return vec[0];
}

詳細信息


Pretests

Pretest #1:

score: 15
Accepted
time: 615ms
memory: 27376kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2048ms
memory: 90352kb

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: 606ms
memory: 27312kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2005ms
memory: 90340kb

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