Submission #566259

#TimeUsernameProblemLanguageResultExecution timeMemory
566259hollwo_pelwGenetics (BOI18_genetics)C++17
46 / 100
2008 ms30452 KiB
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/trie_policy.hpp> // #include <ext/rope> using namespace std; // using namespace __gnu_cxx; // using namespace __gnu_pbds; void Hollwo_Pelw(); signed main(){ #ifndef hollwo_pelw_local if (fopen(".inp", "r")) assert(freopen(".inp", "r", stdin)), assert(freopen(".out", "w", stdout)); #else using namespace chrono; auto start = steady_clock::now(); #endif cin.tie(0), cout.tie(0) -> sync_with_stdio(0); int testcases = 1; // cin >> testcases; for (int test = 1; test <= testcases; test++){ // cout << "Case #" << test << ": "; Hollwo_Pelw(); } #ifdef hollwo_pelw_local auto end = steady_clock::now(); cout << "\nExecution time : " << duration_cast<milliseconds> (end - start).count() << "[ms]" << endl; #endif } const int N = 4100; const string G = "ACGT"; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int n, m, k, p[N]; string s[N]; bitset<N> f[N][4]; inline int diff(int i, int j) { int res = 0; for (int x = 0; x < 4; x++) res += (f[i][x] ^ f[j][x]).count(); return res / 2; } void Hollwo_Pelw(){ cin >> n >> m >> k; for (int i = 0; i < n; i++) { cin >> s[i]; for (int j = 0; j < m; j++) for (int x = 0; x < 4; x++) if (G[x] == s[i][j]) f[i][x].set(j); } iota(p, p + n, 0); shuffle(p, p + n, rng); for (int i = 0; i < n; i++) { bool ok = 1; for (int j = 0; j < n && ok; j++) { if (i == j) continue; if (diff(p[i], p[j]) != k) ok = 0; } if (ok) { cout << p[i] + 1 << '\n'; return ; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...