QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#492305 | #9156. 百万富翁 | Erinyes# | 77.99996 | 5148ms | 97628kb | C++14 | 1.6kb | 2024-07-26 11:20:52 | 2024-07-26 11:20:52 |
Judging History
answer
#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
int id[1005][1005],ins[1000005];
map<pair<int,int>,int>g;
int cnt,sum;
// vector<int> ask(vector<int>a,vector<int>b){
// cnt++,sum+=a.size();
// vector<int>c;
// for(int i=0;i<a.size();i++){
// c.push_back(b[i]);
// }return c;
// }
int richest(int n, int T, int S){
int len[9]={2,2,2,2,4,6,19,34,34};
if(n==1000){
vector<int>A,B;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
id[i][j]=A.size(),A.push_back(i),B.push_back(j);
}
}
auto C=ask(A,B);
for(int i=0;i<n;i++){
bool tag=1;
for(int j=0;j<i;j++)if(C[id[j][i]]!=i)tag=0;
for(int j=i+1;j<n;j++)if(C[id[i][j]]!=i)tag=0;
if(tag)return i;
}
}
vector<int>d;
for(int i=0;i<n;i++)d.push_back(i);
// int k=2;
// while(ceil(log(n)/log(k+1))>T)k++;
// int k=5,len=5;
for(int t=0;t<9;t++){
int k=len[t];
vector<int>A,B,C;g.clear();
for(int i=0;i<d.size();i+=k){
int r=min(i+k,(int)d.size());
for(int a=i;a<r;a++){
for(int b=a+1;b<r;b++){
g[{a,b}]=A.size();
A.push_back(d[a]),B.push_back(d[b]);
}
}
}
C=ask(A,B);
vector<int>D;
for(int i=0;i<d.size();i+=k){
int r=min(i+k,(int)d.size());
for(int a=i;a<r;a++){
bool tag=1;
for(int b=i;b<a;b++)if(C[g[{b,a}]]!=d[a]){tag=0;break;}
for(int b=a+1;b<r;b++)if(C[g[{a,b}]]!=d[a]){tag=0;break;}
if(tag){D.push_back(d[a]);break;}
}
}
d=D;
}
return d.front();
}
// int main(){
// cout<<richest(1000000,10,2000000)<<endl;
// cout<<cnt<<' '<<sum<<endl;
// }
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 620ms
memory: 31500kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 63
Acceptable Answer
time: 5107ms
memory: 96844kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1095993 14773494820717744637 0.741176 16601290867448354019
result:
points 0.741176 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1095993
Final Tests
Test #1:
score: 15
Accepted
time: 617ms
memory: 31872kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 63
Acceptable Answer
time: 5148ms
memory: 97628kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1095993 14773494820717744637 0.741176 16601290867448354019
result:
points 0.741176 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1095993