QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#493679 | #9156. 百万富翁 | dongyc666 | 15 | 624ms | 27732kb | C++17 | 1.1kb | 2024-07-27 11:35:56 | 2024-07-27 11:35:56 |
Judging History
answer
#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
const int NR=1e6+10;
bool vis[NR];
int n;
const int val[]={0,2,2,2,2,3,6,19,183};
#define pb emplace_back
int from[NR];
int dfs(int col,vector<int> idx){
if(idx.size()==1)return idx[0]-1;
cerr<<col<<" "<<idx.size()<<endl;
int len=idx.size();
for(int i=0;i<len;i++)from[i]=i/val[col];
vector<int>a,b;
for(int i=0;i<len;i++)
for(int j=i+1;j<len;j++)
if(from[i]==from[j])a.pb(idx[i]-1),b.pb(idx[j]-1);
else break;
vector<int>c=ask(a,b);
for(int i=0;i<c.size();i++)
if(c[i]==a[i])vis[b[i]+1]=1;
else vis[b[i]+1]=1;
vector<int>nidx;
for(int i=0;i<len;i++)
if(!vis[idx[i]])nidx.pb(idx[i]);
return dfs(col+1,nidx);
}
int richest(int N, int T, int S){
n=N;
memset(vis,0,sizeof(vis));
if(N=1000){
vector<int>a,b;
for(int i=1;i<n;i++)
for(int j=i+1;j<=n;j++)
a.pb(i-1),b.pb(j-1);
vector<int>c=ask(a,b);
for(int i=0;i<c.size();i++)
if(c[i]==a[i])vis[b[i]+1]=1;
else vis[a[i]+1]=1;
for(int i=1;i<=n;i++)
if(!vis[i])return i-1;
}
vector<int>tmp;
for(int i=1;i<=n;i++)tmp.pb(i);
return dfs(1,tmp);
}
詳細信息
Pretests
Pretest #1:
score: 15
Accepted
time: 624ms
memory: 27732kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 0
Memory Limit Exceeded
input:
1000000 20 2000000 29091473
output:
Unauthorized output
result:
Final Tests
Test #1:
score: 15
Accepted
time: 619ms
memory: 26188kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 0
Memory Limit Exceeded
input:
1000000 20 2000000 29091471
output:
Unauthorized output