結果

問題 No.1566 All Even
ユーザー ぷらぷら
提出日時 2021-06-26 13:26:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,103 bytes
コンパイル時間 2,033 ms
コンパイル使用メモリ 202,844 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-07 16:28:57
合計ジャッジ時間 3,244 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,384 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1 ms
4,380 KB
testcase_23 WA -
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N,M;
    cin >> N >> M;
    if(N >= 5) {
        cout << 0 << endl;
        return 0;
    }
    vector<int>x(M),y(M),z(M);
    for(int i = 0; i < M; i++) {
        cin >> x[i] >> y[i] >> z[i];
        x[i]--;
        y[i]--;
    }
    int ans = 0;
    for(int i = 0; i < (1 << N*N); i++) {
        vector<vector<int>>cnt(N,vector<int>(N));
        for(int j = 0; j < N*N; j++) {
            cnt[j/N][j%N] = 1 & (i >> j);
        }
        bool flag = true;
        for(int j = 0; j < M; j++) {
            if(cnt[x[j]][y[j]] != z[j]) {
                flag = false;
            }
        }
        for(int j = 0; j < N-1; j++) {
            for(int k = 0; k < N-1; k++) {
                int res = 0;
                res += cnt[j][k];
                res += cnt[j][k+1];
                res += cnt[j+1][k];
                res += cnt[j+1][k+1];
                if(res%2 != 0) {
                    flag = false;
                }
            }
        }
        if(flag) {
            ans++;
        }
    }
    cout << ans << endl;
}
0