QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#488237 | #9156. 百万富翁 | frostaur_ | 63.75 | 2312ms | 86136kb | C++14 | 2.1kb | 2024-07-23 18:50:55 | 2024-07-23 18:50:55 |
Judging History
answer
#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(x,qwq,qaq) for(int (x)=(qwq);(x)<=(qaq);++(x))
#define emp emplace_back
int richest(int N,int T,int S) {
int n=N;
if(T==1) {
vector<int>a(N*(N-1)/2),b(N*(N-1)/2);
int tot=-1;
rep(i,1,n)rep(j,i+1,n) {
++tot;
a[tot]=i,b[tot]=j;
}
vector<int>c=ask(a,b);
tot=-1;
rep(i,1,n) {
int cnt=0;
rep(j,i+1,n) {
++tot;
cnt+=(c[tot]==i);
}
if(cnt==n-i)return i;
}
} else {
vector<int>rest(N);
rep(i,0,N-1)rest[i]=i;
while(rest.size()>1) {
int sz=rest.size();
vector<int>nw;
if(sz<=245) {
vector<int>a(sz*(sz-1)/2),b(sz*(sz-1)/2);
int tot=-1;
rep(i,0,sz-1)rep(j,i+1,sz-1) {
++tot;
a[tot]=rest[i],b[tot]=rest[j];
}
vector<int>c=ask(a,b);
tot=-1;
rep(i,0,sz-1) {
int cnt=0;
rep(j,i+1,sz-1) {
++tot;
cnt+=(c[tot]==rest[i]);
}
if(cnt==sz-1-i)return rest[i];
}
} else if(sz<=62500) {
vector<int>a,b;
rep(i,0,sz/4-1) {
rep(j,i*4,i*4+3) {
rep(k,j+1,i*4+3) {
a.emp(rest[j]),b.emp(rest[k]);
}
}
}
rep(i,sz-sz%4,sz-1) {
rep(j,i+1,sz-1) {
a.emp(rest[i]),b.emp(rest[j]);
}
}
vector<int>c=ask(a,b);
int tot=-1;
rep(i,0,sz/4-1) {
int flag=0;
rep(j,i*4,i*4+3) {
int cnt=0;
rep(k,j+1,i*4+3) {
++tot;
cnt+=(c[tot]==rest[j]);
}
if(cnt==i*4+3-j&&!flag) {
nw.emp(rest[j]);
flag=1;
}
}
}
rep(i,sz-sz%4,sz-1) {
int cnt=0;
rep(j,i+1,sz-1) {
++tot;
cnt+=(c[tot]==rest[i]);
}
if(cnt==sz-1-i){
nw.emp(rest[i]);
break;
}
}
} else {
vector<int>a(sz/2),b(sz/2);
rep(i,0,sz/2-1) {
a[i]=rest[i*2];
b[i]=rest[i*2+1];
--S;
}
nw=ask(a,b);
if(sz&1)nw.emp(rest[sz-1]);
}
rest=nw;
--T;
}
assert(rest.size()==1&&S>=0&&T>=0);
return rest[0];
}
return 20080111;
}
详细
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 3ms
memory: 15916kb
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: 63.75
Acceptable Answer
time: 2301ms
memory: 86068kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1091899 15924754611964940863 0.750000 5959859307801994407
result:
points 0.75 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1091899
Final Tests
Test #1:
score: 0
Wrong Answer
time: 6ms
memory: 15924kb
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: 63.75
Acceptable Answer
time: 2312ms
memory: 86136kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1091899 15924754611964940863 0.750000 5959859307801994407
result:
points 0.75 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1091899