QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#817782 | #9156. 百万富翁 | Mirasycle | 81.999975 | 3439ms | 97848kb | C++14 | 1.5kb | 2024-12-17 12:18:02 | 2024-12-17 12:18:02 |
Judging History
answer
#include<bits/stdc++.h>
#include "richest.h"
#define pb emplace_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int maxn=1e6+10;
typedef long long ll;
void chkmax(int &x,int y){ x=x>y?x:y; }
void chkmin(int &x,int y){ x=x<y?x:y; }
vector<int> ask(vector<int> a,vector<int> b);
int len[8]={2,2,2,2,3,6,19,183},vis[maxn];
vector<int> a,b,res,p;
void solve(vector<int> p){
for(auto v:p) vis[v]=1;
for(auto u:p)
for(auto v:p){
if(u>=v) continue;
a.pb(u); b.pb(v);
}
}
int get(int& cur,int l,int r){
if(l==r) return -1;
int tot=(r-l+1)*(r-l)/2;
for(int i=cur;i<cur+tot;i++){
if(res[i]==a[i]) vis[b[i]]=0;
else vis[a[i]]=0;
} int win=0;
for(int i=cur;i<cur+tot;i++){
if(vis[a[i]]) win=a[i];
if(vis[b[i]]) win=b[i];
}
for(int i=cur;i<cur+tot;i++) vis[a[i]]=vis[b[i]]=0;
cur+=tot; return win;
}
int richest(int N,int T,int S){
p.clear(); for(int i=0;i<N;i++) p.pb(i);
if(T==20){
vector<int> tmp;
for(int i=0;i<8;i++){
tmp.clear(); a.clear(); b.clear();
for(int j=0;j<(int)p.size();j+=len[i]){
vector<int> que;
for(int k=j;k<min((int)p.size(),j+len[i]);k++) que.pb(p[k]);
if(que.size()==1) tmp.pb(que[0]);
else solve(que);
}
res=ask(a,b); int cur=0;
for(int j=0;j<(int)p.size();j+=len[i]){
int z=get(cur,j,min(j+len[i],(int)p.size())-1);
if(~z) tmp.pb(z);
}
swap(p,tmp);
}
return p[0];
}else{
a.clear(); b.clear();
solve(p); int cur=0;
res=ask(a,b);
return get(cur,0,N-1);
}
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 669ms
memory: 26524kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 67
Acceptable Answer
time: 3439ms
memory: 97848kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960 2586970244946203279 0.788235 12006835993993373281
result:
points 0.788235 Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960
Final Tests
Test #1:
score: 15
Accepted
time: 677ms
memory: 26420kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 67
Acceptable Answer
time: 3436ms
memory: 97644kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960 2586970244946203279 0.788235 12006835993993373281
result:
points 0.788235 Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960