Submission #473713

#TimeUsernameProblemLanguageResultExecution timeMemory
473713elgamalsalmanGenetics (BOI18_genetics)C++14
0 / 100
2078 ms3404 KiB
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //#include <ext/pb_ds/assoc_container.hpp> //using namespace __gnu_pbds; // //typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; typedef long long ll; int n, m, k, score[4150], validCount; string codes[4150]; bitset<4150> isValid; int main() { ios_base::sync_with_stdio(0); cin.tie(0); Tree<int> oset; cin >> n >> m >> k; for (int i = 0; i < n; i++) { cin >> codes[i]; oset.insert(i); } srand(123); while (oset.size() > 1) { int i = rand() % n, j = rand() % n; if (i == j) continue; i = *oset.find_by_order(i); j = *oset.find_by_order(j); int diffCount = 0; for (int c = 0; c < m; c++) if (codes[i][c] != codes[j][c]) diffCount++; if (diffCount != k) { if (n % 2) { oset.erase(i); n--; } oset.erase(j); n--; } } //for (int i = 0; i < n; i++) cerr << "// score[" << i << "] : " << score[i] << '\n'; cout << *oset.begin() + 1 << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...