求助。。。模板哪错了。。。

P3812 【模板】线性基

错的太离谱了,~~抄~~看题解吧
by 142857cs @ 2019-05-13 20:12:44


位运算错了QAQ
by ddwqwq @ 2019-05-13 20:15:02


@[142857cs](/space/show?uid=35760) 并没有,我有一个同学和我写的一样,但是他对了
by xiaolou @ 2019-05-13 20:22:44


@[142857cs](/space/show?uid=35760) 他是这么写的 ```cpp #include<iostream> #include<cstdio> #define int long long using namespace std; inline int read() { int n=0,f=1,ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { n=n*10+ch-'0'; ch=getchar(); } return n*f; } int xx[51]; void insert(int x) { for(int i=50;i>=0;i--) { if(!(x>>i))continue; if(!xx[i]) { xx[i]=x; return; } x^=xx[i]; } } signed main() { int n,x; n=read(); for(int i=1;i<=n;i++) { x=read(); insert(x); } int ans=0; for(int i=50;i>=0;i--)if((ans^xx[i])>ans)ans^=xx[i]; printf("%lld\n",ans); return 0; } ```
by xiaolou @ 2019-05-13 20:23:19


@[xiaolou](/space/show?uid=68675) 那你去问你同学啊,发帖问我们是什么意思.jpg
by yurzhang @ 2019-05-13 20:24:41


@[xiaolou](/space/show?uid=68675) 他对应该是数据水。。。
by 142857cs @ 2019-05-13 20:25:07


@[yurzhang](/space/show?uid=126486) 我跟他对了一下,找不出问题,老师也没解决
by xiaolou @ 2019-05-13 20:25:25


好像是我看错了。。。
by 142857cs @ 2019-05-13 20:25:32


@[142857cs](/space/show?uid=35760) 正确性应该是没有问题的,我找老师问过
by xiaolou @ 2019-05-13 20:26:08


@[xiaolou](/space/show?uid=68675) a<<64这种东西好像会出锅
by 142857cs @ 2019-05-13 20:26:35


| 下一页