QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#492276#9156. 百万富翁zwh2008#15 622ms23100kbC++14821b2024-07-26 11:06:162024-07-26 11:06:16

Judging History

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

  • [2024-07-26 11:06:16]
  • 评测
  • 测评结果:15
  • 用时:622ms
  • 内存:23100kb
  • [2024-07-26 11:06:16]
  • 提交

answer

#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
mt19937 rd(5384);
int rg(int l,int r){return rd()%(r-l+1)+l;}
int richest(int n,int T,int S) {
    if(T==1) {
        vector<int>a,b,ct(n);
        for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)a.push_back(i),b.push_back(j);
        vector<int>c=ask(a,b);
        for(int i:c)ct[i]++;
        for(int i=0;i<n;i++)if(ct[i]==n-1)return i;
    }
    vector<int>a(n),del(n);
    iota(a.begin(),a.end(),0);
    while(a.size()>1) {
        int m=a.size();
        vector<int>qb(m),qc,na;
        for(int i=0;i<m;i++)qb[i]=a[(i+1)%m];
        qc=ask(a,qb);
        for(int i=0;i<qc.size();i++)if(qc[i]==a[i])del[qb[i]]=1;else del[a[i]]=1;
        for(int i:a)if(!del[i])na.push_back(i);else del[i]=0;
        a=na;
    }
    return a[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 622ms
memory: 21920kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 0
Time Limit Exceeded

input:

1000000 20 2000000 29091473

output:

Unauthorized output

result:



Final Tests

Test #1:

score: 15
Accepted
time: 618ms
memory: 23100kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 0
Time Limit Exceeded

input:

1000000 20 2000000 29091471

output:

Unauthorized output

result: