QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#502406 | #9156. 百万富翁 | phlap# | 71.00004 | 2467ms | 90632kb | C++20 | 1.4kb | 2024-08-03 05:05:52 | 2024-08-03 05:05:56 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
void thing(vector<int> &vec, int block, int n){
vector<int> group;
vector<int> query1, query2;
for(int i=0; i<vec.size(); i++){
group.push_back(vec[i]);
if(group.size()==block){
for(int j=0; j<block; j++){
for(int k=0; k<j; k++){
query1.push_back(group[j]);
query2.push_back(group[k]);
}
}
group.clear();
}
}
for(int j=0; j<group.size(); j++){
for(int k=0; k<j; k++){
query1.push_back(group[j]);
query2.push_back(group[k]);
}
}
if(query1.empty()) return;
int isless[n];
memset(isless, 0, sizeof isless);
vector<int> result=ask(query1, query2);
for(int i=0; i<query1.size(); i++){
if(result[i]==query1[i]) isless[query2[i]]=1;
else isless[query1[i]]=1;
}
vec.clear();
for(auto i: result) if(!isless[i]) vec.push_back(i);
if(group.size()==1) vec.push_back(group[0]);
sort(vec.begin(), vec.end());
vec.erase(unique(vec.begin(), vec.end()), vec.end());
}
int richest(int n, int t, int s){
vector<int> vec;
for(int i=0; i<n; i++) vec.push_back(i);
if(t==1){
thing(vec, n, n);
return vec[0];
}
thing(vec, 2, n);
thing(vec, 2, n);
thing(vec, 2, n);
thing(vec, 2, n);
thing(vec, 3, n);
thing(vec, 6, n);
thing(vec, 20, n);
thing(vec, 174, n);
return vec[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 634ms
memory: 24428kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 56
Acceptable Answer
time: 2458ms
memory: 90496kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 56 / 85, maxt = 8, maxs = 1100079 3861759353456146731 0.658824 10645090175016484801
result:
points 0.658824 Partially correct Case 2, 56 / 85, maxt = 8, maxs = 1100079
Final Tests
Test #1:
score: 15
Accepted
time: 606ms
memory: 23008kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 56
Acceptable Answer
time: 2467ms
memory: 90632kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 56 / 85, maxt = 8, maxs = 1100079 3861759353456146731 0.658824 10645090175016484801
result:
points 0.658824 Partially correct Case 2, 56 / 85, maxt = 8, maxs = 1100079