QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#500606 | #9156. 百万富翁 | mirkdang | 0 | 223ms | 83868kb | C++14 | 1.4kb | 2024-08-01 16:10:29 | 2024-08-01 16:10:30 |
Judging History
answer
#include<bits/stdc++.h>
#include"richest.h"
using namespace std;
vector<int> p,q,r,s;
int d[8]={500000,250000,125000,62496,20832,3472,183,1};
void join(vector<int> x)
{
int l=x.size();
for(int i=0;i<l;i++)for(int j=i+1;j<l;j++)
p.push_back(x[i]),q.push_back(x[j]);
s.push_back(l);
}
void submit(){r=ask(p,q);}
vector<int> result()
{
vector<int> res;int f=0;
for(int i:s)
{
map<int,int> mp;
for(int j=0;j<i*(i-1)/2;j++)
mp[r[f+j]]++;f+=i*(i-1)/2;
for(auto [x,y]:mp)if(y==i-1)
res.push_back(x);
}
return res;
}
void clear(){p.clear(),q.clear(),s.clear();}
int richest(int N,int T,int S)
{
if(N==1000)
{
vector<int> a,b;a.resize(N);
iota(a.begin(),a.end(),0);
join(a),submit(),b=result();
return b[0];
}
if(N==1000000)
{
vector<int> a;a.resize(N);
iota(a.begin(),a.end(),0);
int n=N;
for(int v=0;v<8;v++)
{
clear();
for(int i=0,lp=0,rp=n/d[v];i<d[v];i++)
{
vector<int> b;b.reserve(n/d[v]+5);
for(int j=lp;j<rp;j++)
b.emplace_back(a[j]);
join(b);
lp=rp,rp+=n/d[v]+(i+n%d[v]>=d[v]);
}
submit(),a=result(),n=d[v];
}
return a[0];
}
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 74ms
memory: 28188kb
input:
1000 1 499500 957319859
output:
Too many total elements in queries 1469670942222006797 0.000000 6906350380861515327
result:
points 0.0 Too many total elements in queries
Pretest #2:
score: 0
Wrong Answer
time: 223ms
memory: 83868kb
input:
1000000 20 2000000 29091473
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer
Final Tests
Test #1:
score: 0
Wrong Answer
time: 70ms
memory: 28116kb
input:
1000 1 499500 957319857
output:
Too many total elements in queries 1469670942222006797 0.000000 6906350380861515327
result:
points 0.0 Too many total elements in queries
Test #2:
score: 0
Wrong Answer
time: 217ms
memory: 83816kb
input:
1000000 20 2000000 29091471
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer