QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#509741 | #9156. 百万富翁 | jamjanek# | 0 | 218ms | 76904kb | C++20 | 1.2kb | 2024-08-08 18:06:58 | 2024-08-08 18:06:58 |
Judging History
answer
#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
int zlicz[1000010];
int na_raz(vector<int>X){
if(X.size()==1)return X[0];
vector<int>a,b;
for(int i=0;i<(int)X.size();i++)
for(int j=i+1;j<(int)X.size();j++){
a.push_back(X[i]);
b.push_back(X[j]);
}
vector<int>wynik = ask(a,b);
for(auto j: wynik)zlicz[j]=0;
for(auto j: wynik)zlicz[j]++;
for(auto j: wynik)
if(zlicz[j]==(int)X.size()-1)return j;
return 0;
}
int richest(int n, int t, int s) {
if(s==2000000)s=1099944;
vector<int>mozliwe;
int i;
for(i=0;i<n;i++)mozliwe.push_back(i);
// while(!((long long)mozliwe.size()*((long long)mozliwe.size()-1)/2<=s)){
// printf("srodek %lld %d\n", (long long)mozliwe.size()*((long long)mozliwe.size()-1)/2, s);
while(mozliwe.size()>1){
vector<int>a,b;
for(i=0;i<(int)mozliwe.size();i++){
if(i%2==1)b.push_back(mozliwe[i]);
if(i%2==0 && i!=(int)mozliwe.size()-1)a.push_back(mozliwe[i]);
}
if(mozliwe.size()%2)
mozliwe = ask(a,b);
else{
int pom = mozliwe.back();
mozliwe = ask(a,b);
mozliwe.push_back(pom);
}
s-=a.size();
}
return mozliwe[0];
// return na_raz (mozliwe);
}
詳細信息
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 0ms
memory: 8100kb
input:
1000 1 499500 957319859
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Pretest #2:
score: 0
Wrong Answer
time: 216ms
memory: 76904kb
input:
1000000 20 2000000 29091473
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer
Final Tests
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 8028kb
input:
1000 1 499500 957319857
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Test #2:
score: 0
Wrong Answer
time: 218ms
memory: 76396kb
input:
1000000 20 2000000 29091471
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer