QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#740671 | #9156. 百万富翁 | piggy123 | 15 | 623ms | 34060kb | C++20 | 1.6kb | 2024-11-13 11:00:51 | 2024-11-13 11:00:51 |
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=1;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();j++){
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 tot=-1;
for (ll k=0;k<vct[j].size();k++)id2[k]=++tot;
vector<int> cnt;cnt.resize(tot/ls[i]+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];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 615ms
memory: 34060kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 0
Runtime Error
input:
1000000 20 2000000 29091473
output:
Unauthorized output
result:
Final Tests
Test #1:
score: 15
Accepted
time: 623ms
memory: 33920kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 0
Runtime Error
input:
1000000 20 2000000 29091471
output:
Unauthorized output