Submission #166884

#TimeUsernameProblemLanguageResultExecution timeMemory
166884Eae02Genetics (BOI18_genetics)C++14
19 / 100
2055 ms4192 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; vector<int> permN(n); iota(permN.begin(), permN.end(), 0); random_shuffle(permN.begin(), permN.end()); vector<int> permM(m); iota(permM.begin(), permM.end(), 0); random_shuffle(permM.begin(), permM.end()); for (int i = 0; i < n; i++) { string ln; cin >> ln; for (int j = 0; j < m; j++) { if (ln[j] == 'A') dna[permN[i]].set(permM[j]); } } vector<bool> cand(n, true); int numCand = n; for (int a = 0; a < n; a++) { for (int b = a + 1; b < n; b++) { if ((cand[a] || cand[b]) && (dna[a] ^ dna[b]).count() != k) { numCand -= cand[a] + cand[b]; cand[a] = false; cand[b] = false; if (numCand == 1) { for (int a = 0; a < n; a++) { if (cand[a]) { cout << (find(permN.begin(), permN.end(), a) - permN.begin() + 1) << "\n"; } } return 0; } } } } }

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:37:58: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if ((cand[a] || cand[b]) && (dna[a] ^ dna[b]).count() != k) {
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...