题目传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=4269
离线版题目:http://paste.ubuntu.com/18971803/
这个题目,拿到以后,一脸懵逼啊QAQ,想拿BFS乱搞一搞,估计会T,结果还是可耻地看了题解
高斯消元求线性基QAQ,又没有学过QAQ,I well vegtable are (T_T)
其实也不难,每一个数的二进制看成方程组,然后上高斯消元。
求出线性基之后,全部^起来就是最大值,找一个最小的^一下就是次小值
#include<iostream> #include<cstdio> using namespace std; const int MAXN = 100000+9; int n,arr[MAXN],cnt; inline void Gauss(){ for (int k=31;k;k--){ int w = 1<<(k-1), pos; for (pos=cnt+1;pos<=n;pos++) if (arr[pos]&w) break; if (pos==n+1) continue; else { swap(arr[++cnt], arr[pos]); for (int i=1;i<=n;i++) if (i!=cnt && (arr[i]&w)) arr[i] ^= arr[cnt]; } } } int main(){ scanf("%d",&n); for (int i=1;i<=n;i++) scanf("%d",&arr[i]); Gauss(); int vout = 0; for (int i=1;i<=cnt;i++) vout ^= arr[i]; printf("%d ",vout); printf("%d\n",vout ^= arr[cnt]); return 0; }
好像还有一种方法,写法跟在线求解亦或方程组很像。
但感觉不如直接高斯消元优雅,且时间复杂度相同,所以就不贴代码啦!
Say, you got a nice article post.Thanks Again. Keep writing.
Thanks so much for the post.Really looking forward to read more. Keep writing.
Appreciate you sharing, great article post.Much thanks again. Cool.
Muchos Gracias for your post.Really thank you! Much obliged.
I really like and appreciate your post.Really thank you! Really Cool.
Really enjoyed this blog article.Really thank you!
This is one awesome blog article.Really thank you! Great.
Very neat article.Thanks Again. Really Great.
Thanks so much for the blog post.Really thank you! Awesome.
A round of applause for your post.Really looking forward to read more. Want more.
Say, you got a nice article post.Thanks Again. Awesome.
I really liked your post.Thanks Again. Really Great.
Thank you ever so for you blog article.Thanks Again. Awesome.
Really informative article.Really thank you! Really Cool.
A big thank you for your article.Much thanks again. Really Cool.
Very informative blog.Really looking forward to read more. Really Great.
Great, thanks for sharing this blog article.Really thank you! Cool.
Major thanks for the blog article.Thanks Again.
Appreciate you sharing, great blog.Much thanks again. Really Great.
I think this is a real great article post.Thanks Again. Keep writing.
I appreciate you sharing this blog.Really thank you! Great.
This is one awesome article post.Much thanks again. Really Cool.
A round of applause for your blog article.Really thank you! Awesome.
I cannot thank you enough for the blog article. Cool.
Thanks a lot for the article post.Really looking forward to read more. Want more.
A big thank you for your article post.Really thank you! Keep writing.
Thanks-a-mundo for the article.Really thank you! Will read on…
Thanks a lot for the post.Really thank you! Really Great.
Thank you ever so for you blog article.Thanks Again. Awesome.
Major thanks for the blog.Really looking forward to read more. Keep writing.
Ridiculous story there. What occurred after? Thanks!
Major thankies for the post.Really thank you! Will read on…
magnificent issues altogether, you just received a new reader.
What could you suggest about your post that you just made a few days in the past?
Any certain?
Muchos Gracias for your article post.Really thank you! Fantastic.
Thanks for the blog. Really Cool.
Thanks for sharing, this is a fantastic article.Really thank you! Awesome.
A big thank you for your blog article.Much thanks again. Keep writing.
Thanks for the blog article. Much obliged.
I value the blog post.Much thanks again. Want more.
Hey, thanks for the blog post.Thanks Again. Much obliged.
Im grateful for the post.
wow, awesome blog article.Much thanks again. Great.
Looking forward to reading more. Great blog article.Thanks Again. Much obliged.
I enjoy what you guys tend to be up too. This type of clever work and coverage!
Keep up the awesome works guys I’ve added you guys to our blogroll.
Major thanks for the article. Want more.
Very informative article.Thanks Again. Great.
I value the article.Thanks Again. Really Cool.
Having read this I thought it was really informative.
I appreciate you spending some time and energy to put this
short article together. I once again find myself spending a lot
of time both reading and leaving comments. But so what, it was still worth it!
Fantastic article.Really looking forward to read more. Really Great.
Thank you for your blog article.Really looking forward to read more. Really Great.
I really like and appreciate your blog post. Much obliged.
I am so grateful for your blog.Really looking forward to read more. Fantastic.
Thanks-a-mundo for the article.Thanks Again. Great.
Major thankies for the article post.Much thanks again. Will read on…
Great post. Awesome.
Really informative post. Awesome.
Thanks a lot for the article post.Really looking forward to read more. Great.
This is my first time pay a visit at here and i am truly happy to read all
at alone place.
I cannot thank you enough for the blog article.Thanks Again. Really Great.
Thank you ever so for you post.Much thanks again. Keep writing.
Thanks a lot for the blog post. Awesome.
I really liked your blog post.Really looking forward to read more. Really Great.
I really enjoy the article.Really looking forward to read more. Really Cool.
Thanks for the article.Thanks Again. Really Great.
A round of applause for your post.Much thanks again.
Hi, i read your blog occasionally and i own a similar
one and i was just curious if you get a lot of spam feedback?
If so how do you reduce it, any plugin or anything you can advise?
I get so much lately it’s driving me crazy so any support is
very much appreciated.
Say, you got a nice blog article.Thanks Again. Keep writing.
Thank you for your blog.Really looking forward to read more. Want more.
This information is priceless. When can I find out more?
Today, I went to the beachfront with my kids. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.”
She put the shell to her ear and screamed.
There was a hermit crab inside and it pinched her ear.
She never wants to go back! LoL I know this is totally
off topic but I had to tell someone!
My partner and I absolutely love your blog and find the majority of your post’s to be precisely what I’m looking for.
Would you offer guest writers to write content for you personally?
I wouldn’t mind producing a post or elaborating on a number of the subjects you write in relation to here.
Again, awesome web site!
Thanks so much for the blog post.Much thanks again. Cool.
Im grateful for the blog.Really thank you! Awesome.
Very good blog post.Thanks Again. Really Great.
Way cool! Some very valid points! I appreciate you penning
this post and also the rest of the website is extremely good.
I loved your article post.Thanks Again. Keep writing.
Greetings from Idaho! I’m bored to death at work so I decided to browse your
site on my iphone during lunch break. I enjoy the knowledge you present
here and can’t wait to take a look when I get home.
I’m surprised at how fast your blog loaded on my cell phone ..
I’m not even using WIFI, just 3G .. Anyways,
excellent site!
Great article.Really looking forward to read more. Awesome.
Really informative blog.Much thanks again. Much obliged.
It’s very trouble-free to find out any topic on net as compared to books, as
I found this paragraph at this web page.
A big thank you for your article.Thanks Again. Fantastic.
Great, thanks for sharing this blog article. Awesome.
Im thankful for the blog article.Thanks Again. Want more.
Fantastic article. Really Cool.
Thanks for sharing, this is a fantastic article post.Really thank you! Keep writing.
Thank you for your article post. Great.
I really appreciate this post. I have been looking everywhere for this! Thank goodness I found it on Bing. You have made my day! Thank you again!
Really enjoyed this blog article.Really looking forward to read more. Cool.
Thanks so much for the blog post. Awesome.
Really informative post.Thanks Again. Will read on…
Really enjoyed this blog post. Fantastic.
Hi there, I read your blog like every week. Your story-telling style is
witty, keep it up!
I really like and appreciate your blog article.Thanks Again. Cool.
I truly appreciate this article.Thanks Again. Keep writing.
Wow, great blog article. Great.
Hey, thanks for the blog article.Really looking forward to read more. Will read on…
I really liked your article.Really looking forward to read more. Awesome.
A round of applause for your blog post.Really thank you! Cool.
I appreciate you sharing this post. Much obliged.
Muchos Gracias for your blog.Much thanks again. Really Cool.
Very neat blog.Really looking forward to read more. Really Great.
I really liked your blog.Thanks Again. Keep writing.
Great blog article.Thanks Again. Much obliged.
I appreciate you sharing this post.Really looking forward to read more. Awesome.
Enjoyed every bit of your blog post.
I appreciate you sharing this blog post.Thanks Again. Really Cool.
Thank you for your blog article. Want more.
Thanks a lot for the blog article. Want more.
Great, thanks for sharing this blog.Thanks Again. Want more.
Thanks for sharing, this is a fantastic post.Really looking forward to read more. Cool.
Thanks for sharing, this is a fantastic article post.Much thanks again. Really Great.
It’s a shame you don’t have a donate button! I’d definitely donate to this
superb blog! I suppose for now i’ll settle for bookmarking and adding your RSS feed to my Google account.
I look forward to fresh updates and will talk
about this website with my Facebook group. Chat soon!
This design is steller! You most certainly know how to keep a reader amused.
Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!)
Great job. I really enjoyed what you had to say, and more than that, how you presented it.
Too cool!
Thanks a lot for the post.Really thank you! Keep writing.
Im thankful for the post.Really looking forward to read more. Really Great.
Wonderful web site. Plenty of helpful info here. I’m sending it to a few pals
ans also sharing in delicious. And certainly, thank you in your effort!
This info is worth everyone’s attention. Where can I find out more?
I cannot thank you enough for the article post. Awesome.
I read this piece of writing completely about the resemblance of hottest
and preceding technologies, it’s amazing article.
Admiring the hard work you put into your website and detailed information you provide.
It’s nice to come across a blog every once in a while that isn’t the same outdated rehashed material.
Fantastic read! I’ve saved your site and I’m including your RSS feeds to my
Google account.
Very informative blog.Thanks Again. Much obliged.
I loved your blog post.Really looking forward to read more. Really Great.
Fantastic blog article. Really Cool.
Im obliged for the blog.Really thank you! Fantastic.
I really liked your article.Thanks Again. Want more.
Thanks for the blog article. Awesome.
Looking forward to reading more. Great article.Thanks Again. Will read on…
I truly appreciate this blog article.Really looking forward to read more.
Really enjoyed this blog post.Much thanks again. Keep writing.
Thanks again for the article post.Really thank you! Cool.
Really enjoyed this article.Really looking forward to read more. Keep writing.
Thank you ever so for you article post.Really thank you! Want more.
We stumbled over here coming from a different website and thought I should check things out.
I like what I see so now i’m following you. Look forward to looking at your web page yet again.
A round of applause for your article.Thanks Again. Great.
I truly appreciate this post.Really thank you! Really Great.
A big thank you for your post.Really thank you! Really Great.
Major thanks for the blog. Much obliged.
Appreciate you sharing, great article.Really thank you!
Very neat article post.Really thank you!
Major thankies for the blog article. Great.
Say, you got a nice article.Thanks Again. Great.
Great, thanks for sharing this article.Thanks Again. Will read on…
Very neat blog post.Really thank you! Really Great.
I think this is a real great article.Really thank you! Keep writing.
A big thank you for your post.Really looking forward to read more. Will read on…
Major thankies for the blog.Really looking forward to read more. Want more.
Thanks a lot for the post.Much thanks again. Want more.
wow, awesome blog post.Much thanks again. Awesome.
I loved your blog post.Thanks Again. Want more.
I appreciate you sharing this article post.Much thanks again. Much obliged.
Hey, thanks for the article. Really Cool.
I really liked your post.Really thank you! Really Great.
I’m not sure why but this website is loading incredibly slow for me.
Is anyone else having this problem or is it a problem on my end?
I’ll check back later and see if the problem still exists.
Wow, superb blog layout! How long have you ever been blogging for?
you make blogging glance easy. The total look of your web site is great, let alone the content
material!
Thank you ever so for you article.Thanks Again. Will read on…
Hey, thanks for the blog post.Thanks Again. Awesome.
I loved your post.Much thanks again. Really Great.
Say, you got a nice article post. Fantastic.
I truly appreciate this article.Really looking forward to read more. Awesome.
I truly appreciate this post.Really thank you! Really Cool.
Very good article post.Thanks Again. Really Cool.
Say, you got a nice article.Thanks Again. Keep writing.
I really like and appreciate your article post.Really looking forward to read more. Really Great.
This is one awesome article.Really thank you! Really Cool.
I cannot thank you enough for the post.Much thanks again. Really Cool.
Im obliged for the blog post. Awesome.
Im thankful for the blog post.Really looking forward to read more. Great.
I really enjoy the blog.Really thank you! Really Cool.
Major thankies for the blog.Much thanks again. Really Great.
Awesome article post.Much thanks again. Really Great.
Wow, great article.Much thanks again. Really Great.
I think this is a real great post.Really thank you! Really Great.
Great web site. Lots of useful information here. I’m sending it to some friends ans also sharing in delicious. And obviously, thanks for your sweat!
A big thank you for your blog post.Thanks Again. Fantastic.
Wow, great blog post.Really thank you! Really Cool.
Im obliged for the article.Much thanks again. Want more.
Hey, thanks for the article.Much thanks again. Will read on…
Im grateful for the article.Much thanks again. Cool.
Great, thanks for sharing this post.Really looking forward to read more. Keep writing.
Awesome article.Thanks Again. Cool.
A round of applause for your article.Really looking forward to read more. Awesome.
I loved your blog article.Really thank you! Much obliged.
This is one awesome article. Really Great.
Major thanks for the article.Much thanks again. Fantastic.
I am so grateful for your blog article.Really thank you! Great.
I think this is a real great blog article.Thanks Again. Keep writing.
Major thankies for the blog post.Really looking forward to read more.
Enjoyed every bit of your blog post.Really thank you! Really Great.
Thank you for your blog post. Great.
Great, thanks for sharing this post.Really looking forward to read more. Cool.
Major thanks for the blog post.Really thank you! Really Cool.
Really informative blog article.Really looking forward to read more. Really Great.
Hey, thanks for the post.Really looking forward to read more. Will read on…
Im thankful for the article.Really thank you! Keep writing.
Very neat post. Keep writing.
Muchos Gracias for your blog article.Much thanks again. Fantastic.
Im obliged for the blog.Really looking forward to read more. Keep writing.
Appreciate you sharing, great post.Really thank you! Great.
Awesome blog article.Really looking forward to read more. Fantastic.
I truly appreciate this post.Much thanks again. Great.