After applying Gaussian algorithm on a array how could I restore those numbers of which XOR is maximum?

Let a[3] = {11, 5, 9} If I apply Gaussian algorithm we will find maximum xor is 14.And used numbers are 11, 5.How to restore this 11, 5?

# | User | Rating |
---|---|---|

1 | MiFaFaOvO | 3681 |

2 | tourist | 3673 |

3 | Um_nik | 3493 |

4 | apiadu | 3397 |

5 | 300iq | 3317 |

6 | maroonrk | 3250 |

7 | Benq | 3230 |

8 | LHiC | 3229 |

9 | TLE | 3223 |

10 | ecnerwala | 3216 |

# | User | Contrib. |
---|---|---|

1 | antontrygubO_o | 192 |

2 | Errichto | 186 |

3 | tourist | 182 |

4 | vovuh | 170 |

5 | pikmike | 168 |

6 | ko_osaga | 165 |

7 | Radewoosh | 164 |

8 | Um_nik | 162 |

9 | 300iq | 155 |

10 | Petr | 153 |

After applying Gaussian algorithm on a array how could I restore those numbers of which XOR is maximum?

Let a[3] = {11, 5, 9} If I apply Gaussian algorithm we will find maximum xor is 14.And used numbers are 11, 5.How to restore this 11, 5?

↑

↓

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/04/2020 03:37:25 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

if you have additional time (where

cis the max value) it is easy to restore. Here is a slow implementation, which can be improved to if you replace the bitset and just store by wich indices the value is composed (there are always atmost bits set).Thanks man. I got. :)

I did a python 2 implementation to show one way of doing it, in , where

mis the number of linear independent binary vectors in A. Note that so it runs really quick, also note that nothing in my implementation is python specific I just really like how pseudo code like python is. The essential stuff lies in the two functions, the rest just shows how to use the functions.The output is

I didn't get anything. I have a little knowledge of python. But thanks.You tried to help me.