#include <bits/stdc++.h>
using ll = long long;
template <class T>
using Vec = std::vector<T>;
using Bit = std::bitset<4100>;
std::random_device dev;
std::default_random_engine gen(dev() ^ std::clock());
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int N, M, K;
std::cin >> N >> M >> K;
if (N <= 100 and M <= 100) {
Vec<Vec<char>> S(N, Vec<char>(M));
for (auto& v: S) {
for (auto& x: v) {
std::cin >> x;
}
}
for (int i = 0; i < N; ++i) {
bool ok = true;
for (int j = 0; j < N; ++j) {
if (i == j) continue;
int cnt = 0;
for (int k = 0; k < M; ++k) {
cnt += (S[i][k] != S[j][k]);
}
if (cnt != K) {
ok = false;
break;
}
}
if (ok) {
std::cout << i + 1 << '\n';
}
}
return 0;
}
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);
Vec<int> order(N);
std::iota(order.begin(), order.end(), 0);
std::shuffle(order.begin(), order.end(), gen);
Vec<Vec<int>> memo(N, Vec<int>(N));
for (const auto i: order) {
if (!good[i]) continue;
for (const auto j: order) {
if (i != j) {
if (memo[i][j] == 0) {
memo[i][j] = ((int) (bit[i] ^ bit[j]).count() == K ? 1 : -1);
}
if (memo[i][j] == -1) {
good[i] = good[j] = false;
break;
}
}
}
if (good[i]) {
std::cout << i + 1 << '\n';
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3068 ms |
51964 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |