Submission #1276484

#TimeUsernameProblemLanguageResultExecution timeMemory
1276484rtriGenetics (BOI18_genetics)C++20
19 / 100
228 ms1264 KiB
#include <bits/stdc++.h> using namespace std; int n, m, k; int main() { cin.sync_with_stdio(false); cin >> n >> m >> k; vector<bitset<1800>> lines(n); for (int i = 0; i < n; i++) { string line; cin >> line; for (int j = 0; j < m; j++) { if (line[j] == 'A') lines[i][j] = 1; } } random_device rd; mt19937 g(rd()); vector<int> order(n); for (int i = 0; i < n; i++) order[i] = i; shuffle(order.begin(), order.end(), g); vector<int> candidates = order; for (int j = 0; j < n; j++) { vector<int> new_candidates; for (int i = 0; i < candidates.size(); i++) { if (candidates[i] == order[j]) { new_candidates.push_back(candidates[i]); continue; } int diff = (lines[order[j]] ^ lines[candidates[i]]).count(); if (diff == k) new_candidates.push_back(candidates[i]); } candidates = new_candidates; } assert(candidates.size() == 1); cout << candidates[0] + 1 << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...