Submission #676881

#TimeUsernameProblemLanguageResultExecution timeMemory
676881CyanmondGenetics (BOI18_genetics)C++17
27 / 100
2066 ms6992 KiB
#include <bits/stdc++.h> std::clock_t start_time; double get_sec() { return (std::clock() - start_time) / CLOCKS_PER_SEC; } int main() { start_time = std::clock(); std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int N, M, K; std::cin >> N >> M >> K; std::vector<std::string> S(N); for (auto &e : S) { std::cin >> e; } std::vector<bool> ok(N, true); std::mt19937 mt(100); std::uniform_int_distribution dist(0, N - 1); while (get_sec() < 1) { const int a = dist(mt); const int b = dist(mt); if (a == b) { continue; } int cnt = 0; for (int i = 0; i < M; ++i) { if (S[a][i] != S[b][i]) { ++cnt; } } if (cnt != K) { ok[a] = false; ok[b] = false; } } for (int i = 0; i < N; ++i) { if (not ok[i]) { continue; } for (int j = 0; j < N; ++j) { if (i == j) { continue; } int cnt = 0; for (int k = 0; k < M; ++k) { if (S[i][k] != S[j][k]) { ++cnt; } } if (cnt != K) { ok[i] = false; ok[j] = false; break; } } if (ok[i]) { std::cout << i + 1 << std::endl; break; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...