Submission #566240

#TimeUsernameProblemLanguageResultExecution timeMemory
566240two_sidesGenetics (BOI18_genetics)C++17
27 / 100
2066 ms4000 KiB
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); const int N = 4005; string s[N]; int n, m, k; int calc(int i, int j) { int res = 0; for (int x = 0; x < m; x++) res += s[i][x] != s[j][x]; return res; } int main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> m >> k; vector<int> can; for (int i = 0; i < n; i++) { cin >> s[i]; if (can.empty()) can.push_back(i); else if (calc(can.back(), i) != k) can.pop_back(); else can.push_back(i); } for (int i : can) { vector<int> ord(n); iota(ord.begin(), ord.end(), 0); shuffle(ord.begin(), ord.end(), rng); bool flag = true; for (int j : ord) if (i != j && calc(i, j) != k) { flag = false; break; } if (flag) return cout << i + 1, 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...