Submission #566249

#TimeUsernameProblemLanguageResultExecution timeMemory
566249two_sidesGenetics (BOI18_genetics)C++17
46 / 100
260 ms21416 KiB
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); const int N = 4005; string s[N]; int n, m, k, num[N]; long long sum[N][4]; int index(char c) { if (c == 'A') return 0; if (c == 'C') return 1; if (c == 'G') return 2; return 3; } int rand(int l, int r) { return uniform_int_distribution<int> (l, r)(rng); } int calc(int i, int j) { int res = 0; for (int x = 0; x < m; x++) res += s[i][x] != s[j][x]; return res; } int main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> m >> k; for (int i = 0; i < n; i++) { num[i] = rand(1, 1e9); cin >> s[i]; for (int j = 0; j < m; j++) sum[j][index(s[i][j])] += num[i]; } for (int i = 0; i < n; i++) { long long tmp = 0; for (int j = 0; j < m; j++) for (int c = 0; c < 4; c++) if (index(s[i][j]) != c) tmp += sum[j][c]; for (int j = 0; j < n; j++) if (i != j) tmp -= 1ll * num[j] * k; if (!tmp) cout << i + 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...