結果

問題 No.1056 2D Lamps
ユーザー pockynypockyny
提出日時 2020-05-15 23:07:14
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,267 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 72,048 KB
実行使用メモリ 4,964 KB
最終ジャッジ日時 2023-10-19 16:46:37
合計ジャッジ時間 3,338 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 WA -
testcase_03 AC 130 ms
4,964 KB
testcase_04 AC 129 ms
4,964 KB
testcase_05 AC 130 ms
4,964 KB
testcase_06 AC 130 ms
4,964 KB
testcase_07 AC 135 ms
4,964 KB
testcase_08 AC 134 ms
4,964 KB
testcase_09 AC 134 ms
4,964 KB
testcase_10 AC 135 ms
4,964 KB
testcase_11 AC 129 ms
4,964 KB
testcase_12 AC 131 ms
4,964 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 19 ms
4,460 KB
testcase_16 AC 17 ms
4,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <bitset>

using namespace std;
int a[210][210],b[210][210];
bitset<40000> bs[210];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int i,j,k,n,m;
    cin >> n >> m;
    if(n<=3){
        for(i=0;i<m - 1;i++){
            for(j=i + 1;j<m;j++){
                cout << 1;
            }
            cout << "\n";
        }
    }
    for(k=0;k<m;k++){
        for(i=0;i<n;i++){
            for(j=0;j<n;j++){
                char c; cin >> c;
                if(c=='#') a[i][j] = 1;
                else a[i][j] = 0;
            }
        }
        for(i=0;i<n - 1;i++){
            for(j=0;j<n - 1;j++){
                int num = (a[i][j] + a[i + 1][j] + a[i][j + 1] + a[i + 1][j + 1])%2;
                b[i][j] = num;
            }
        }
        for(i=1;i<n - 2;i++){
            for(j=1;j<n - 2;j++){
                int num = (b[i - 1][j] + b[i + 1][j] + b[i][j + 1] + b[i][j - 1])%2;
                if(num==0) bs[k][i*n + j] = 0;
                else bs[k][i*n + j] = 1;
            }
        }
    }
    for(i=0;i<m - 1;i++){
        for(j=i + 1;j<m;j++){
            bitset<40000> bss = bs[i]^bs[j];
            if(bss.none()) cout << 1;
            else cout << 0;
        }
        cout << "\n";
    }
}
0