QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#529185 | #9156. 百万富翁 | Physics212303 | 100 ✓ | 3743ms | 104564kb | C++17 | 1.4kb | 2024-08-24 10:20:43 | 2024-08-24 10:20:44 |
Judging History
answer
#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
const vector<int> l={1000000,500000,250000,125000,62499,20832,3472,183,1};
int richest(int n,int t,int s){
if(n==1000){
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);
vector v(n,vector<bool>(n));
for(int i=0,p=0;i<n;i++)
for(int j=i+1;j<n;j++)
v[i][j]=(c[p++]==i),v[j][i]=!v[i][j];
vector<int> p(n);
iota(p.begin(),p.end(),0);
sort(p.begin(),p.end(),[&](int x,int y){return v[x][y];});
return p[0];
}
vector<int> r(n);
iota(r.begin(),r.end(),0);
for(int i=1;i<l.size();i++){
vector<vector<int> > w(l[i]);
for(int j=0;j<r.size();j++)
w[j%l[i]].emplace_back(r[j]);
vector<int> a,b;
for(int j=0;j<l[i];j++)
for(int x=0;x<w[j].size();x++)
for(int y=x+1;y<w[j].size();y++)
a.emplace_back(w[j][x]),b.emplace_back(w[j][y]);
auto c=ask(a,b); int p=0;
vector<int>().swap(r);
for(int j=0;j<l[i];j++){
vector v(w[j].size(),vector<bool>(w[j].size()));
for(int x=0;x<w[j].size();x++)
for(int y=x+1;y<w[j].size();y++)
v[x][y]=(c[p++]==w[j][x]),v[y][x]=!v[x][y];
vector<int> p(w[j].size());
iota(p.begin(),p.end(),0);
sort(p.begin(),p.end(),[&](int x,int y){return v[x][y];});
r.emplace_back(w[j][p[0]]);
}
}
return r[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 619ms
memory: 23888kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 85
Accepted
time: 3714ms
memory: 104564kb
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: 626ms
memory: 23148kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 85
Accepted
time: 3743ms
memory: 102160kb
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