QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#490232 | #9156. 百万富翁 | DaiRuiChen007 | 100 ✓ | 2194ms | 101948kb | C++17 | 946b | 2024-07-25 13:15:54 | 2024-07-25 13:15:54 |
Judging History
answer
#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
const int tr[]={1,183,3472,20832,62500,125000,250000,500000,1000000};
int richest(int N,int T,int S) {
if(T==1) {
vector <int> x,y;
for(int i=0;i<N;++i) for(int j=i+1;j<N;++j) {
x.push_back(i),y.push_back(j);
}
vector <int> z=ask(x,y),del(N,0);
for(int i=0;i<(int)z.size();++i) del[x[i]+y[i]-z[i]]=1;
for(int i=0;i<N;++i) if(!del[i]) return i;
return -1;
}
vector <int> id(N); iota(id.begin(),id.end(),0);
for(int k=8;k;--k) {
int u=tr[k],v=tr[k-1],cur=0;
vector <int> x,y;
for(int i=0;i<v;++i) {
int b=u/v+(i<u%v);
for(int s=0;s<b;++s) for(int t=s+1;t<b;++t) {
x.push_back(id[cur+s]);
y.push_back(id[cur+t]);
}
cur+=b;
}
vector <int> z=ask(x,y),del(N,0),nw;
for(int i=0;i<(int)z.size();++i) del[x[i]+y[i]-z[i]]=1;
for(int i:id) if(!del[i]) nw.push_back(i);
id.swap(nw);
}
return id[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 592ms
memory: 25372kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 85
Accepted
time: 2194ms
memory: 101948kb
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: 615ms
memory: 25324kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 85
Accepted
time: 2155ms
memory: 86444kb
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