QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#527194 | #9156. 百万富翁 | kymmykym# | 39.000005 | 2259ms | 78432kb | C++14 | 996b | 2024-08-22 11:49:04 | 2024-08-22 11:49:05 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>pi;
int do_all(vector<int> vec){
vector<int>A,B;
for(int i=0;i<vec.size();i++){
for(int j=i+1;j<vec.size();j++){
A.push_back(vec[i]);
B.push_back(vec[j]);
}
}
vector<int>res=ask(A,B);
map<int,int>cnt;
int mx=0;
for(auto x:res){
cnt[x]++;
}
for(auto x:cnt)mx=max(mx,x.second);
for(auto x:cnt){
if(x.second==mx)return x.first;
}
assert(0);
}
const int LIM = 512;
int richest(int n, int T, int S){
vector<int> vec;
for(int i=0;i<n;i++){
vec.push_back(i);
}
if(n==1000)return do_all(vec);
while(vec.size()>LIM){
vector<int> A, B;
vector<int>nvec;
for(int i=0;i<(int)vec.size()-1;i+=2){
A.push_back(vec[i]);
B.push_back(vec[i+1]);
}
if((int)vec.size() % 2 == 1){
nvec.push_back(vec.back());//bye
}
vector<int>res=ask(A,B);
for(auto x:res){
nvec.push_back(x);
}
vec=nvec;
}
return do_all(vec);
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 759ms
memory: 23160kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 24
Acceptable Answer
time: 2259ms
memory: 78432kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 24 / 85, maxt = 12, maxs = 1118827 2893638666736527915 0.282353 2192392354278883037
result:
points 0.282353 Partially correct Case 2, 24 / 85, maxt = 12, maxs = 1118827
Final Tests
Test #1:
score: 15
Accepted
time: 752ms
memory: 25352kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 24
Acceptable Answer
time: 2148ms
memory: 78428kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 24 / 85, maxt = 12, maxs = 1118827 2893638666736527915 0.282353 2192392354278883037
result:
points 0.282353 Partially correct Case 2, 24 / 85, maxt = 12, maxs = 1118827