SGU 275 To xor or not to xor (Gaussian elimination element)
Question address: SGU 275
First of all, the greedy idea is that every binary bit should be 1 as much as possible, and whether it can be 1 should be solved by Gaussian elimination element. When this digit has a variable that can be set to 1, it indicates that this digit can be set to 1, and the variable is controlled, and then the bitwise is reduced to a low position.
The Code is as follows:
#include
#include
#include
#include
#include #include
#include
#include
#include
using namespace std;#define LL __int64#define pi acos(-1.0)const int mod=1e9+7;const int INF=1e9;const double eqs=1e-9;int mat[100][110], equ, var, vis[110];LL a[100];LL gauss(){ LL ans=0; int i, j, k, h; memset(vis,0,sizeof(vis)); for(i=equ-1;i>=0;i--){ ans<<=1; for(j=0;j
=0;k--){ if(mat[k][j]){ for(h=0;h<=var;h++){ mat[k][h]^=mat[i][h]; } } } } } return ans;}int main(){ int n, i, k; LL y; scanf("%d",&n); equ=0; var=n; for(i=0;i
>=1; } equ=max(equ,k); } for(i=0;i