# bzoj-2115-xor-wc2011

Source: Internet
Author: User

Describe

Analysis
• I glued the library in.
• Only a path of point 1 to N and a number of rings in the graph can be represented as all paths by XOR. So how many loops do you need to be able to make sure that all the paths are represented? In fact, it does not need a lot, because some rings can be different or get through other rings, just to ensure that the ring is independent of each other, there is a difference between the 22 sides (multiplier). Constructs a spanning tree, the statistic non-tree edge and the spanning tree formation ring can, at most only m-n+1 a ring. DFS implementations are available with a time complexity of O (M).

• In combination with the above properties, it is possible to design a greedy statement: The x is represented as a binary number, from the high to the low enumeration, the current potential energy takes 1 to take 1.

1. Enumerates the current bits from high to low;
2. Select a number a[i] in the a array with the current bit 1], or 1 if there is no a[i];
3. If the current bit of x is 0, then X=x xor a[i];
4. All the current bits in the A array are 1 (a[j] and A[i] xor, A[j]=a[j] a[i], ext. 1).
• The final x guarantee must be the largest, with a time complexity of O (NB). (n is the size of a array, and B is bits number)

• Read the above analysis went to play, the results several times WA. Then, in contrast to the Hzwer code, it was found that the elements he had selected in step 2 were not considered at the back of Step 2 o'clock.
• Why didn't you say anything in the information?
• Change this place, you're right.

• 1 move directly to the left 62 will be an error. But once in a while it's OK ...

• What is the relationship between this problem and the Gaussian elimination element and the linear basis?
Code

https://code.csdn.net/snippets/619907

• Home: http://blog.csdn.net/qq_21110267

bzoj-2115-xor-wc2011

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.