Submission #657647

#TimeUsernameProblemLanguageResultExecution timeMemory
657647MilosMilutinovicGenetics (BOI18_genetics)C++14
46 / 100
2078 ms104420 KiB
/** * author: wxhtzdy * created: 10.11.2022 15:59:08 **/ #include <bits/stdc++.h> using namespace std; string c = "ACGT"; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, k; cin >> n >> m >> k; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; } map<string, int> mp; vector<int> ids; vector<string> new_s; for (int i = 0; i < n; i++) { mp[s[i]] += 1; if (mp[s[i]] == 1) { new_s.push_back(s[i]); ids.push_back(i); } } swap(s, new_s); n = (int) s.size(); const int N = 4100; vector<vector<bitset<N>>> f(4, vector<bitset<N>>(n)); for (int i = 0; i < 4; i++) { for (int j = 0; j < n; j++) { for (int k = 0; k < m; k++) { f[i][j][k] = (c[i] == s[j][k] ? 1 : 0); } } } vector<vector<int>> d(n, vector<int>(n)); vector<bool> is(n, true); for (int i = 0; i < n; i++) { if (mp[s[i]] > 1) { is[i] = false; } } for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { for (int p = 0; p < 4; p++) { if (!is[i] && !is[j]) { continue; } d[i][j] += (f[p][i] ^ f[p][j]).count(); if (d[i][j] > k * 2) { is[i] = false; is[j] = false; } } if (d[i][j] != k * 2) { is[i] = false; is[j] = false; } } } for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (d[i][j] != k * 2) { is[i] = false; is[j] = false; } } } for (int i = 0; i < n; i++) { if (is[i]) { cout << ids[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...