QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#496756 | #9156. 百万富翁 | wsc2008 | 100 ✓ | 2634ms | 82160kb | C++14 | 1.6kb | 2024-07-28 15:37:46 | 2024-07-28 15:37:47 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
vector<int>v;
void work(int k,int k1,int c){
int n=v.size();
vector<vector<bool>>o;
vector<int>qa,qb;
int nc=0;
for(int s=0;s<n;){
int go=(nc<c?k1:k);
int len=min(go,n-s);
rep(i,s,s+len-1){
rep(j,i+1,s+len-1)qa.push_back(v[i]),qb.push_back(v[j]);
}
nc++,s+=go;
}
nc=0;
vector<int>qans=ask(qa,qb);
int cur=0;
vector<int>nv;
for(int s=0;s<n;){
int go=(nc<c?k1:k);
int len=min(go,n-s);
vector<vector<bool>>o;
o.resize(len);
rep(i,0,len-1)o[i].resize(len);
rep(i,s,s+len-1){
rep(j,i+1,s+len-1){
if(qans[cur]==v[i])o[i-s][j-s]=1,o[j-s][i-s]=0;
else o[i-s][j-s]=0,o[j-s][i-s]=1;
cur++;
}
}
rep(i,s,s+len-1){
bool fl=1;
rep(j,s,s+len-1){
if(i==j)continue;
fl&=o[i-s][j-s];
}
if(fl){
nv.push_back(v[i]);
break;
}
}
nc++,s+=go;
}
v=nv;
}
int richest(int N, int T, int S) {
v.clear();
rep(i,0,N-1)v.push_back(i);
if(N==1000){
work(N,-1,0);
return v[0];
}
work(2,-1,0);
work(2,-1,0);
work(2,-1,0);
work(2,-1,0);
work(3,4,1);
work(6,7,1);
work(19,18,5);
work(v.size(),-1,0);
return v[0];
}
詳細信息
Pretests
Pretest #1:
score: 15
Accepted
time: 638ms
memory: 25240kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 85
Accepted
time: 2609ms
memory: 82160kb
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: 15
Accepted
time: 632ms
memory: 23788kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 85
Accepted
time: 2634ms
memory: 81944kb
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