Submission #15257311


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

// https://atcoder.jp/contests/abc173/tasks/abc173_c

int main() {

    int H, W, K;
    cin >> H >> W >> K;
    vector<vector<char>> input(H, vector<char>(W));
    for (auto &x: input) {
        for (auto &y: x) {
            cin >> y;
        }
    }
    int ans{0};
    for (int maskR = 0; maskR < (1 << H); ++maskR) {

        for (int maskC = 0; maskC < (1 << W); ++maskC) {

            int black = 0;
            for (int i = 0; i < H; ++i) {

                for (int j = 0; j < W; ++j) {

                    if (
                            ((maskR >> i) & 1) == 0 and
                            ((maskC) >> j & 1) == 0 and
                            input[i][j] == '#'
                            ) {
                        ++black;
                    }
                }
            }
            if (black == K) ++ans;
        }
    }
    cout << ans;
}

Submission Info

Submission Time
Task C - H and V
User akbar1214
Language C++ (GCC 9.2.1)
Score 300
Code Size 959 Byte
Status AC
Exec Time 8 ms
Memory 3632 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 16
Set Name Test Cases
Sample a01.txt, a02.txt, a03.txt, a04.txt
All a01.txt, a02.txt, a03.txt, a04.txt, b05.txt, b06.txt, b07.txt, b08.txt, b09.txt, b10.txt, b11.txt, b12.txt, b13.txt, b14.txt, b15.txt, b16.txt
Case Name Status Exec Time Memory
a01.txt AC 8 ms 3496 KiB
a02.txt AC 2 ms 3544 KiB
a03.txt AC 2 ms 3468 KiB
a04.txt AC 2 ms 3416 KiB
b05.txt AC 1 ms 3628 KiB
b06.txt AC 2 ms 3596 KiB
b07.txt AC 2 ms 3600 KiB
b08.txt AC 2 ms 3632 KiB
b09.txt AC 2 ms 3548 KiB
b10.txt AC 2 ms 3596 KiB
b11.txt AC 7 ms 3548 KiB
b12.txt AC 2 ms 3600 KiB
b13.txt AC 2 ms 3436 KiB
b14.txt AC 2 ms 3492 KiB
b15.txt AC 2 ms 3524 KiB
b16.txt AC 2 ms 3420 KiB