QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#500471 | #9156. 百万富翁 | mirkdang | Compile Error | / | / | C++14 | 1.3kb | 2024-08-01 12:43:36 | 2024-08-01 12:43:37 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int x[8]={500000,250000,125000,62496,20832,3472,183,1};
int xhs(vector<int> x)
{
int l=x.size();
vector<int> a,b,c;map<int,int> mp;
a.reserve(l*(l-1)/2),b.reserve(l*(l-1)/2);
for(int i=0;i<l;i++)for(int j=i+1;j<l;j++)
a.emplace_back(x[i]),b.emplace_back(x[j]);
c=ask(a,b);for(int i:c)mp[i]++;
for(auto [p,q]:mp)if(q==l)return p;
}
int richest(int N,int T,int S)
{
if(N==1000)
{
vector<int> a;a.resize(N);
iota(a.begin(),a.end(),0);
return xhs(a);
}
if(N==1000000)
{
vector<int> a;a.resize(N);
iota(a.begin(),a.end(),0);
int n=N;
for(int r=0;r<8;r++)
{
vector<int> b(n/x[r]),c(n/x[r]+1),t;
t.reserve(x[r]);
for(int i=0;i<x[r]-n%x[r];i++)
{
for(int j=0;j<n/x[r];j++)
b[j]=a[n/x[r]*i+j];
t.emplace_back(xhs(b));
}
for(int i=0;i<n%x[r];i++)
{
for(int j=0;j<n/x[r]+1;j++)
c[j]=a[(x[r]-n%x[r])*(n/x[r])+(n/x[r]+1)*i+j];
t.emplace_back(xhs(c));
}
a=t,n=x[r];
}
return a[0];
}
}
详细
answer.code: In function ‘int xhs(std::vector<int>)’: answer.code:11:7: error: ‘ask’ was not declared in this scope 11 | c=ask(a,b);for(int i:c)mp[i]++; | ^~~ answer.code:12:14: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 12 | for(auto [p,q]:mp)if(q==l)return p; | ^ answer.code:13:1: warning: control reaches end of non-void function [-Wreturn-type] 13 | } | ^ answer.code: In function ‘int richest(int, int, int)’: answer.code:47:1: warning: control reaches end of non-void function [-Wreturn-type] 47 | } | ^