QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#500383 | #9156. 百万富翁 | Flamire# | 0 | 0ms | 0kb | C++20 | 1.3kb | 2024-08-01 10:48:46 | 2024-08-01 10:48:46 |
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
struct info{int x,y,k;};
bool ok[1000011];int n;
void askask(int x,int y,int k)
{
vector<int> a,b;
static vector<int> vv;vv.clear();
::n=n;
for(int i=0;i<n;++i)if(ok[i])vv.push_back(i);
int pt=0;
while(x--)
{
vector<int> aa;
for(int _=0;_<k;++_)
{
aa.push_back(vv.back());vv.pop_back();
}
for(int _=0;_<aa.size();++_)for(int __=_+1;__<aa.size();++__)a.push_back(aa[_]),b.push_back(aa[__]);
}
while(y--)
{
vector<int> aa;
for(int _=0;_<k+1;++_)
{
aa.push_back(vv.back());vv.pop_back();
}
for(int _=0;_<aa.size();++_)for(int __=_+1;__<aa.size();++__)a.push_back(aa[_]),b.push_back(aa[__]);
}
auto c=ask(a,b);
for(int i=0;i<a.size();++i)
{
ok[a[i]^b[i]^c[i]]=0;
}
}
int richest(int n, int T, int S) {
for(int i=0;i<n;++i)ok[i]=1;
if(T==1)askask(1,0,n);
else
{
// {1,0,183}
// {5,178,18}
// {3472,0,6}
// {20832,0,3}
// {62488,8,2}
// {125000,0,2}
// {250000,0,2}
// {500000,0,2}
askask(500000,0,2);
askask(250000,0,2);
askask(125000,0,2);
askask(62488,8,2);
askask(20832,0,3);
askask(3472,0,6);
askask(5,178,18);
askask(1,0,183);
}
for(int i=0;i<n;++i)if(ok[i])return i;
return -1;
}
详细
Pretests
Pretest #1:
score: 0
Runtime Error
input:
1000 1 499500 957319859
output:
Unauthorized output
result:
Pretest #2:
score: 0
Runtime Error
input:
1000000 20 2000000 29091473
output:
Unauthorized output
result:
Final Tests
Test #1:
score: 0
Runtime Error
input:
1000 1 499500 957319857
output:
Unauthorized output
result:
Test #2:
score: 0
Runtime Error
input:
1000000 20 2000000 29091471
output:
Unauthorized output