結果

問題 No.3229 Liar Game Comibination
ユーザー jiangxinyang
提出日時 2025-08-08 22:47:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 283 ms / 2,000 ms
コード長 937 bytes
コンパイル時間 2,232 ms
コンパイル使用メモリ 195,556 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-08 22:47:50
合計ジャッジ時間 5,269 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const int N = 200005;
const int INF = 0x3f3f3f3f;
ll powmod(ll x, ll y, ll mod) {
    ll res = 1;
    while (y) {
        if (y & 1) res = res * x % mod;
        y >>= 1;
        x = x * x % mod;
    }
    return res;
}
int main() {
    int n, m;
    ll k;
    cin >> n >> m >> k;
    vector<bitset<3000>> A(m);
    for (int i = 0; i < m; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < n; j++) {
            if (s[j] == '1') A[i][j] = 1;
        }
    }
    int rk = 0;
    for (int j = 0; j < n && rk < m; j++) {
        int t = rk;
        while (t < m && !A[t][j]) t++;
        if (t < m) {
            swap(A[rk], A[t]);
            for (int i = rk + 1; i < m; i++) {
                if (A[i][j]) A[i] ^= A[rk];
            }
            rk++;
        }
    }
    cout << powmod(2, n - rk, k) << "\n";
    return 0;
}
0