QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#502202 | #9156. 百万富翁 | maxrgby# | 26.00002 | 5651ms | 106708kb | C++14 | 1.5kb | 2024-08-03 01:24:23 | 2024-08-03 01:24:28 |
Judging History
answer
#include <bits/stdc++.h>
#include "richest.h"
using namespace std;
// int arr[1000005];
// vector<int> ask(vector<int> a, vector<int> b){
// vector<int> ret;
// for(int i = 0;i < a.size();i++){
// if(arr[a[i]] > arr[b[i]]){
// ret.push_back(a[i]);
// }else{
// ret.push_back(b[i]);
// }
// }
// return ret;
// }
int richest(int n, int t, int s) {
if(t == 1){
vector<int> a,b,c;
set<int> nums;
for(int i = 0;i < n;i++){
for(int j = i+1;j < n;j++){
a.push_back(i);
b.push_back(j);
}
nums.insert(i);
}
c = ask(a,b);
for(int i = 0;i < c.size();i++){
if(c[i] != a[i]){
nums.erase(a[i]);
}else{
nums.erase(b[i]);
}
}
assert(nums.size() == 1);
return *nums.begin();
}
set<int> nums;
for(int i = 0;i < n;i++){
nums.insert(i);
}
while(t--){
vector<int> a,b;
int i = 0;
for(auto it = nums.begin();it != nums.end();it++,i++){
if(i&1){
b.push_back(*it);
}else{
a.push_back(*it);
}
}
if(a.size() != b.size()){
b.push_back({*nums.rbegin()});
}
vector<int> c = ask(a,b);
nums.clear();
for(auto i : c){
nums.insert(i);
}
}
assert(nums.size() == 1);
return *nums.begin();
}
// int main(){
// int n,t,s;
// cin >> n >> t >> s;
// int mx = 0;
// for(int i = 0;i < n;i++){
// cin >> arr[i];
// mx = max(mx,arr[i]);
// }
// //cout << "mx=" << mx << endl;
// //cout << "arr=" << arr[3073] << endl;
// cout << richest(n,t,s) << endl;
// }
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 634ms
memory: 23724kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 11
Acceptable Answer
time: 5649ms
memory: 106464kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 11 / 85, maxt = 20, maxs = 1000007 2862133516934917577 0.129412 3823502568050958645
result:
points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 1000007
Final Tests
Test #1:
score: 15
Accepted
time: 635ms
memory: 21940kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 11
Acceptable Answer
time: 5651ms
memory: 106708kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 11 / 85, maxt = 20, maxs = 1000007 2862133516934917577 0.129412 3823502568050958645
result:
points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 1000007