QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#740711 | #9156. 百万富翁 | piggy123 | 100 ✓ | 3067ms | 111260kb | C++20 | 1.6kb | 2024-11-13 11:13:13 | 2024-11-13 11:13:14 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll id[1005][1005],id2[1000005],ls[10]={500000,250000,125000,62500,20833,3472,183,1};
int richest(int N, int T, int S) {
if (T==1){
vector<int> vct1,vct2;
ll tot=-1;
for (ll i=0;i<N;i++){
for (ll j=i+1;j<N;j++){
vct1.push_back(i);
vct2.push_back(j);
id[i][j]=++tot;
}
}
vector<int> p=ask(vct1,vct2);
for (ll i=0;i<N;i++){
ll c=0;
for (ll j=0;j<N;j++){
if (i!=j){
if (j<i){
c+=p[id[j][i]]==i;
}else{
c+=p[id[i][j]]==i;
}
}
}
if (c==N-1){
return i;
}
}
}
for (ll i=0;i<=N;i++)id2[i]=0;
vector<int> all;
for (ll i=0;i<N;i++)all.push_back(i);
for (ll i=0;i<8;i++){
ll tot=all.size();
vector<vector<int>> vct;
vct.resize(ls[i]+1);
ll ps=0;
for (ll j=0;j<tot;j++){
vct[ps].push_back(all[j]);ps++;ps%=ls[i];
}
vector<int> p1,p2;
for (ll j=0;j<ls[i];j++){
for (ll k=0;k<vct[j].size();k++){
for (ll l=k+1;l<vct[j].size();l++){
p1.push_back(vct[j][k]);p2.push_back(vct[j][l]);
}
}
}
vector<int> p3=ask(p1,p2),p4;
ll rk=-1;
for (ll j=0;j<ls[i];j++){
ll tot2=-1;
for (ll k=0;k<vct[j].size();k++)id2[vct[j][k]]=++tot2;
vector<int> cnt;
cnt.resize(tot2+2);
for (ll k=0;k<vct[j].size();k++){
for (ll l=k+1;l<vct[j].size();l++){
++rk;
cnt[id2[p3[rk]]]++;
}
}
for (ll k=0;k<vct[j].size();k++)if (cnt[id2[vct[j][k]]]==vct[j].size()-1)p4.push_back(vct[j][k]);
}
all=p4;
}
return all[0];
}
詳細信息
Pretests
Pretest #1:
score: 15
Accepted
time: 601ms
memory: 33912kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 85
Accepted
time: 3067ms
memory: 111260kb
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: 603ms
memory: 34344kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 85
Accepted
time: 3057ms
memory: 110540kb
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