QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#515646 | #2554. AND PLUS OR | huaxiamengjin | Compile Error | / | / | C++23 | 1.0kb | 2024-08-11 20:01:11 | 2024-08-11 20:01:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
mt19937 mt(time(NULL));
constexpr int M=(1<<20)+5;
int n,lim,limit,a[M],id[M];
int read(){
int x=0;char ch=getchar();
while (!isdigit(ch)) ch=getchar();
while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
return x;
}
int main(){ n=read();lim=1<<n;
for (int i=0;i<lim;i++) a[i]=read();
auto solve=[&](auto x,auto y)->void {
if (a[x]+a[y]<a[x&y]+a[x|y]){
printf("%d %d\n",x,y);exit(0);
}
};
for (int i=0;i<lim;i++)
for (int j=1;j<lim;j<<=1){
solve(i,j),solve(i,i^j);
iota(id,id+lim,0);
sort(id,id+lim,[&](int x,int y){return a[x]<a[y];});
for (int i=0;i<lim&&i<2048;i++){
if (i<16) limit=lim;
else limit=min(2048,lim);
for (int j=i+1;j<limit;j++)
solve(id[i],id[j]);
}
reverse(id,id+lim);
for (int i=0;i<lim&&i<2048;i++){
if (i<16) limit=lim;
else limit=min(2048,lim);
for (int j=i+1;j<limit;j++)
solve(id[i],id[j]);
}
int T=2048*2048;
while (T--) solve(mt()%lim,mt()%lim);
return puts("-1"),0;
}
詳細信息
answer.code: In function ‘int main()’: answer.code:40:2: error: expected ‘}’ at end of input 40 | } | ^ answer.code:12:11: note: to match this ‘{’ 12 | int main(){ n=read();lim=1<<n; | ^ answer.code: In instantiation of ‘main()::<lambda(auto:65, auto:66)> [with auto:65 = long unsigned int; auto:66 = long unsigned int]’: answer.code:38:19: required from here answer.code:16:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=] 16 | printf("%d %d\n",x,y);exit(0); | ~^ ~ | | | | int long unsigned int | %ld answer.code:16:37: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat=] 16 | printf("%d %d\n",x,y);exit(0); | ~^ ~ | | | | int long unsigned int | %ld