QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#492773 | #9156. 百万富翁 | posvii | 92.999995 | 2384ms | 108228kb | C++14 | 1.7kb | 2024-07-26 15:58:50 | 2024-07-26 15:58:52 |
Judging History
answer
#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e6+5;
const int num[9]={500000,250000,125000,62496,20832,3472,183,1};
vector<int> vec;
bool vis[MAXN];
int _[1005][1005];
int richest(int n,int T,int S) {
if(T==1) {
vector<int> A,B;
for(int i=0;i<n;++i) {
for(int j=i+1;j<n;++j) {
A.emplace_back(i),B.emplace_back(j);
}
}
auto C=ask(A,B);
for(int i=0,k=0;i<n;++i) {
for(int j=i+1;j<n;++j) {
_[i][j]=C[k++];
}
}
int mx=0;
for(int i=1;i<n;++i) {
if(_[mx][i]==i) mx=i;
}
return mx;
}
else {
for(int i=0;i<n;++i) vec.emplace_back(i);
for(int i=0;i<8;++i) {
vector<int> A,B;
int k=num[i],len=vec.size();
for(int j=0;j<len;++j) vis[j]=1;
for(int j=0;j<k;++j) {
for(int t=j;t<len;t+=k) {
for(int l=t+k;l<len;l+=k) {
A.emplace_back(vec[t]);
B.emplace_back(vec[l]);
}
}
}
auto C=ask(A,B);
for(int j=0,cnt=0;j<k;++j) {
for(int t=j;t<len;t+=k) {
for(int l=t+k;l<len;l+=k) {
if(C[cnt++]==vec[t]) vis[l]=0;
else vis[t]=0;
}
}
}
vector<int> tmp;
for(int j=0;j<len;++j) {
if(vis[j]) tmp.emplace_back(vec[j]);
}
vec=tmp;
assert(vec.size()==k);
}
return vec[0];
}
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 609ms
memory: 31516kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 78
Acceptable Answer
time: 2384ms
memory: 91928kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 78 / 85, maxt = 8, maxs = 1099946 9745502946713857387 0.917647 16444671842503264899
result:
points 0.917647 Partially correct Case 2, 78 / 85, maxt = 8, maxs = 1099946
Final Tests
Test #1:
score: 15
Accepted
time: 602ms
memory: 30008kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 78
Acceptable Answer
time: 2261ms
memory: 108228kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 78 / 85, maxt = 8, maxs = 1099946 9745502946713857387 0.917647 16444671842503264899
result:
points 0.917647 Partially correct Case 2, 78 / 85, maxt = 8, maxs = 1099946