結果

問題 No.1056 2D Lamps
ユーザー betrue12betrue12
提出日時 2020-05-15 22:29:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 210 ms / 3,000 ms
コード長 1,023 bytes
コンパイル時間 2,438 ms
コンパイル使用メモリ 203,916 KB
実行使用メモリ 9,252 KB
最終ジャッジ日時 2023-10-19 15:18:35
合計ジャッジ時間 6,022 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
9,220 KB
testcase_01 AC 6 ms
9,220 KB
testcase_02 AC 5 ms
9,216 KB
testcase_03 AC 180 ms
9,252 KB
testcase_04 AC 184 ms
9,252 KB
testcase_05 AC 186 ms
9,252 KB
testcase_06 AC 183 ms
9,252 KB
testcase_07 AC 210 ms
9,252 KB
testcase_08 AC 205 ms
9,252 KB
testcase_09 AC 159 ms
9,252 KB
testcase_10 AC 159 ms
9,252 KB
testcase_11 AC 181 ms
9,252 KB
testcase_12 AC 192 ms
9,252 KB
testcase_13 AC 6 ms
9,216 KB
testcase_14 AC 48 ms
9,216 KB
testcase_15 AC 34 ms
9,220 KB
testcase_16 AC 21 ms
9,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N, M;
    cin >> N >> M;
    bitset<400*400> R[200];
    for(int k=0; k<M; k++){
        int A[210][210] = {0}, B[410][410] = {0}, exist[410][410] = {0};
        char S[201][201];
        for(int i=0; i<N; i++) scanf("%s", S[i]);
        for(int i=0; i<N-1; i++) for(int j=0; j<N-1; j++){
            for(int x=i; x<=i+1; x++) for(int y=j; y<=j+1; y++) A[i][j] ^= (S[x][y] == '#');
            B[i+j][(i-j)+N-2] = A[i][j];
            exist[i+j][(i-j)+N-2] = 1;
        }
        vector<int> res;
        for(int i=0; i<2*N-2; i++) for(int j=0; j<2*N-2; j++){
            int v = 0, ex = 1;
            for(int x=i; x<=i+2; x+=2) for(int y=j; y<=j+2; y+=2){
                ex &= exist[x][y];
                v ^= B[x][y];
            }
            if(v && ex) R[k][i*2*N+j] = 1;
        }
    }
    for(int i=0; i<M-1; i++){
        for(int j=i+1; j<M; j++){
            printf("%d", (R[i] == R[j]));
        }
        printf("\n");
    }
    return 0;
}
0