QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#498900 | #9156. 百万富翁 | Jie_XuSheng | 85 | 2051ms | 91588kb | C++14 | 1.1kb | 2024-07-30 21:16:32 | 2024-07-30 21:16:33 |
Judging History
answer
#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
inline int rd() {
int s=0,m=0;char ch=getchar();
while(!isdigit(ch)) {if(ch=='-')m=1;ch=getchar();}
while( isdigit(ch)) s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
return m?-s:s;
}
int fl[1000005],mp[10]={0,1,183,3472,20832,62498,125000,250000,500000};
int richest(int N,int T,int S) {
memset(fl,0,sizeof(fl));vector<int> now,a,b,ret;
for(int i=0;i<N;i++) now.push_back(i);
for(int ii=8;ii>=1;ii--) {
a.clear(),b.clear(),ret.clear();
int x=N/mp[ii],y=N%mp[ii],pos=0;
for(int i=1;i<=mp[ii]-y;i++,pos+=x) for(int j=pos;j<pos+x;j++) for(int k=pos;k<j;k++)
a.push_back(now[j]),b.push_back(now[k]);
for(int i=1;i<=y;i++,pos+=x+1) for(int j=pos;j<=pos+x;j++) for(int k=pos;k<j;k++)
a.push_back(now[j]),b.push_back(now[k]);
ret=ask(a,b);for(int i=0;i<ret.size();i++) (ret[i]==a[i]?fl[b[i]]++:fl[a[i]]++);
ret.clear();for(int i:now) if(!fl[i]) ret.push_back(i);
now=ret;N=now.size();memset(fl,0,sizeof(fl));
}
return now[0];
}
詳細信息
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 4ms
memory: 13268kb
input:
1000 1 499500 957319859
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Pretest #2:
score: 85
Accepted
time: 2034ms
memory: 91532kb
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: 0
Wrong Answer
time: 4ms
memory: 13096kb
input:
1000 1 499500 957319857
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Test #2:
score: 85
Accepted
time: 2051ms
memory: 91588kb
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