Submission #397742

#TimeUsernameProblemLanguageResultExecution timeMemory
397742KoDGenetics (BOI18_genetics)C++17
19 / 100
2073 ms16472 KiB
#include <bits/stdc++.h>

using ll = long long;

template <class T>
using Vec = std::vector<T>;

using Bit = std::bitset<4100>;

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int N, M, K;
    std::cin >> N >> M >> K;
    Vec<Bit> bit(N);
    for (auto& b: bit) {
        for (int i = 0; i < M; ++i) {
            char c;
            std::cin >> c;
            if (c == 'C') {
                b.set(i);
            }
        }
    }
    Vec<bool> good(N, true);
    for (int i = 0; i < N; ++i) {
        if (!good[i]) continue;
        for (int j = 0; j < N; ++j) {
            if (i != j) {
                if ((int) (bit[i] ^ bit[j]).count() != K) {
                    good[i] = good[j] = false;
                    break;
                }
            }
        }
        if (good[i]) {
            std::cout << i + 1 << '\n';
        }
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...