QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#740548 | #9156. 百万富翁 | robertfan | 0 | 8ms | 15908kb | C++14 | 1.6kb | 2024-11-13 10:24:56 | 2024-11-13 10:24:57 |
Judging History
answer
#include <bits/stdc++.h>
#include "richest.h"
using namespace std;
int mp[8]={1,183,3472,20832,62500,125000,250000,500000};
int dfs(vector<int>all,int t,int s){
if(all.size()==1){
return all[0];
}
vector<int>num;
int cnt=0;
vector<int>ve;
for(int i=0;i<all.size();i++){
cnt++;
num.push_back(all[i]);
if(cnt==mp[t-1]){
ve.push_back(dfs(num,t,s));
num.clear();
cnt=0;
}
}
if(num.size()){
ve.push_back(dfs(num,t-1,s));
}
int len=ve.size();
if(len==1){
return ve[0];
}
vector<int>a,b;
for(int i=0;i<len;i++){
for(int j=i+1;j<len;j++){
a.push_back(ve[i]);
b.push_back(ve[j]);
}
}
vector<int>ok(len);
vector<int>c=ask(a,b);
for(int i=0;i<len;i++){
ok[c[i]]++;
}
for(int i=0;i<len;i++){
if(ok[i]==len-1){
return ve[i];
}
}
return 1;
}
int richest(int N,int T,int S){
vector<int>all;
for(int i=1;i<=N;i++){
all.push_back(i);
}
if(N==1000){
int len=N;
vector<int>a,b;
for(int i=0;i<len;i++){
for(int j=i+1;j<len;j++){
a.push_back(all[i]);
b.push_back(all[j]);
}
}
vector<int>ok(len);
vector<int>c=ask(a,b);
for(int i=0;i<len;i++){
ok[c[i]]++;
}
for(int i=0;i<len;i++){
if(ok[i]==len-1){
return all[i];
}
}
}
return dfs(all,T,S);
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 3ms
memory: 15908kb
input:
1000 1 499500 957319859
output:
Index out of bounds 9775460264716263939 0.000000 6906350380861515327
result:
points 0.0 Index out of bounds
Pretest #2:
score: 0
Memory Limit Exceeded
input:
1000000 20 2000000 29091473
output:
Unauthorized output
result:
Final Tests
Test #1:
score: 0
Wrong Answer
time: 8ms
memory: 15900kb
input:
1000 1 499500 957319857
output:
Index out of bounds 9775460264716263939 0.000000 6906350380861515327
result:
points 0.0 Index out of bounds
Test #2:
score: 0
Memory Limit Exceeded
input:
1000000 20 2000000 29091471
output:
Unauthorized output