QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#492276 | #9156. 百万富翁 | zwh2008# | 15 | 622ms | 23100kb | C++14 | 821b | 2024-07-26 11:06:16 | 2024-07-26 11:06:16 |
Judging History
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];
}
详细
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