QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#537784 | #9156. 百万富翁 | kimmoqt# | 57.00003 | 2389ms | 103636kb | C++20 | 2.0kb | 2024-08-30 18:18:40 | 2024-08-30 18:18:40 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> work(vector<int> v, int b) { // returns the candidate value after one iteration
int N=v.size();
vector<array<int,3>> info;
vector<int> qa,qb;
for(int i=0;i<N;i+=b) {
if(i+b-1<N) {
for(int j=0;j<b;j++) {
for(int k=j+1;k<b;k++) {
qa.push_back(v[i+j]);
qb.push_back(v[i+k]);
info.push_back({i/b,i+j,i+k});
}
}
} else {
int c=N-i;
for(int j=0;j<c;j++) {
for(int k=j+1;k<c;k++) {
qa.push_back(v[i+j]);
qb.push_back(v[i+k]);
info.push_back({i/b,i+j,i+k});
}
}
}
}
vector<int> res=ask(qa,qb);
vector<bool> rem(N);
for(int i=0;i<info.size();i++) {
auto [x,y,z]=info[i];
if(res[i]==v[y]) rem[z]=1;
else rem[y]=1;
}
vector<int> ans;
for(int i=0;i<N;i++)
if(!rem[i]) ans.push_back(v[i]);
assert(ans.size()==(N+b-1)/b);
return ans;
}
int richest(int N, int T, int S) {
vector<int> cur;
for(int i=0;i<N;i++) cur.push_back(i);
if(N==1000) {
cur=work(cur,1000);
return cur[0];
}
cur=work(cur,2);
cur=work(cur,2);
cur=work(cur,2);
cur=work(cur,3);
cur=work(cur,6);
cur=work(cur,18);
cur=work(cur,20);
cur=work(cur,20);
assert(cur.size()==1);
return cur[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 640ms
memory: 29516kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 42
Acceptable Answer
time: 2385ms
memory: 103636kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 42 / 85, maxt = 8, maxs = 1166987 12338831598130391769 0.494118 9868919665266740581
result:
points 0.494118 Partially correct Case 2, 42 / 85, maxt = 8, maxs = 1166987
Final Tests
Test #1:
score: 15
Accepted
time: 631ms
memory: 29048kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 42
Acceptable Answer
time: 2389ms
memory: 103620kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 42 / 85, maxt = 8, maxs = 1166987 12338831598130391769 0.494118 9868919665266740581
result:
points 0.494118 Partially correct Case 2, 42 / 85, maxt = 8, maxs = 1166987