QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#498659 | #9156. 百万富翁 | sunrise2048 | 0 | 18ms | 52960kb | C++14 | 1.5kb | 2024-07-30 17:20:56 | 2024-07-30 17:21:02 |
Judging History
answer
#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
using ll=long long;
const int f[]={500000,250000,125000,62500,20833,3472,183,1};
const int N=1e6+5;
vector<int> v;
int cn[N];
void ak(int z){
int n=v.size();
if(n<=z)return;
int len1=n%z;
int len0=z-n%z;
vector<int> s,t;
for(int k=0;k<len1;++k){
int l=k*(n/z+1);
int r=(k+1)*(n/z+1)-1;
for(int i=l;i<=r;++i){
for(int j=i+1;j<=r;++j){
s.push_back(v[i]);
t.push_back(v[j]);
}
}
}
for(int k=0;k<len0;++k){
int l=len1*(n/z+1)+k*(n/z);
int r=l+n/z-1;
for(int i=l;i<=r;++i){
for(int j=i+1;j<=r;++j){
s.push_back(v[i]);
t.push_back(v[j]);
}
}
}
vector<int> as=ask(s,t);
for(int i:as)cn[i]++;
as.clear();
for(int k=0;k<len1;++k){
int l=k*(n/z+1);
int r=(k+1)*(n/z+1)-1;
for(int i=l;i<=r;++i){
if(cn[v[i]]==n/z){
as.push_back(v[i]);
}
}
}
for(int k=0;k<len0;++k){
int l=len1*(n/z+1)+k*(n/z);
int r=l+n/z-1;
for(int i=l;i<=r;++i){
if(cn[v[i]]==n/z){
as.push_back(v[i]);
}
}
}
v=as;
}
int richest(int n,int t,int s){
v.clear();
for(int i=1;i<=n;++i)v.push_back(i);
int cn=0;
while(v.size()!=1){
ak(f[cn]);++cn;
}
return v[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 1ms
memory: 8024kb
input:
1000 1 499500 957319859
output:
Index out of bounds 9775460264716263939 0.000000 6906350380861515327
result:
points 0.0 Index out of bounds
Pretest #2:
score: 0
Wrong Answer
time: 18ms
memory: 52260kb
input:
1000000 20 2000000 29091473
output:
Index out of bounds 9775460264716263939 0.000000 6906350380861515327
result:
points 0.0 Index out of bounds
Final Tests
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 8216kb
input:
1000 1 499500 957319857
output:
Index out of bounds 9775460264716263939 0.000000 6906350380861515327
result:
points 0.0 Index out of bounds
Test #2:
score: 0
Wrong Answer
time: 18ms
memory: 52960kb
input:
1000000 20 2000000 29091471
output:
Index out of bounds 9775460264716263939 0.000000 6906350380861515327
result:
points 0.0 Index out of bounds