QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#502190 | #9156. 百万富翁 | maxrgby# | 0 | 0ms | 0kb | C++14 | 1.2kb | 2024-08-03 01:22:53 | 2024-08-03 01:22:53 |
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) {
assert(t >= ceil(log2(n)));
assert(s >= 2*n);
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);
}
//cout << "sz=" << nums.size() << endl;
}
//cout << "sum=" << sum << endl;
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;
// }
详细
Pretests
Pretest #1:
score: 0
Runtime Error
input:
1000 1 499500 957319859
output:
Unauthorized output
result:
Pretest #2:
score: 0
Time Limit Exceeded
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 11 / 85, maxt = 20, maxs = 1000007 2862133516934917577 0.129412 3823502568050958645
result:
Final Tests
Test #1:
score: 0
Runtime Error
input:
1000 1 499500 957319857
output:
Unauthorized output
result:
Test #2:
score: 0
Time Limit Exceeded
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 11 / 85, maxt = 20, maxs = 1000007 2862133516934917577 0.129412 3823502568050958645