异或方程组高斯消元模板

inline void solve (int n) {
    for (int i = 1, top = 1; i <= n; i ++, top ++) {
        int cur = 0;
        for (int j = top; j <= n; j ++)
            if (mat[j][i]) {
                cur = j;
                break;
            }
        if (!cur) {
            top --;
            ans = 2ll * ans % MOD;
            continue;
        }
        if (cur != top) swap(mat[cur], mat[top]);
        for (int j = 1; j <= n; j ++)
            if (top != j && mat[j][i]) mat[j] ^= mat[top];
    }
}
posted @   duoluoluo  阅读(25)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
点击右上角即可分享
微信分享提示