제출 #166864

#제출 시각아이디문제언어결과실행 시간메모리
166864Eae02Genetics (BOI18_genetics)C++14
19 / 100
2084 ms43000 KiB
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; bitset<4101> dna[4101]; int diff[4101][4101]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m, k; cin >> n >> m >> k; for (int i = 0; i < n; i++) { string ln; cin >> ln; for (int j = 0; j < m; j++) { if (ln[j] == 'A') dna[i].set(j); } } for (int a = 0; a < n; a++) { for (int b = a + 1; b < n; b++) { diff[a][b] = (dna[a] ^ dna[b]).count(); } } for (int a = 0; a < n; a++) { bool allK = true; for (int b = 0; b < n; b++) { if (b != a && diff[min(a, b)][max(a, b)] != k) { allK = false; break; } } if (allK) { cout << (a + 1) << "\n"; return 0; } } cout << "?\n"; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...