Submission #566271

#TimeUsernameProblemLanguageResultExecution timeMemory
566271two_sidesGenetics (BOI18_genetics)C++17
46 / 100
341 ms17484 KiB
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::high_resolution_clock ::now().time_since_epoch().count()); const int N = 4005; const int MOD = 1e9 + 9; string s[N]; int n, m, k, num[N], sum[N][4]; int add(int x, int y) { return (x += y) >= MOD ? x - MOD : x; } int mul(int x, int y) { return (long long)x * y % MOD; } int sub(int x, int y) { return (x -= y) < 0 ? x + MOD : x; } 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 main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> m >> k; for (int i = 0; i < n; i++) { cin >> s[i]; num[i] = rand(0, MOD - 1); for (int j = 0; j < m; j++) sum[j][index(s[i][j])] = add (sum[j][index(s[i][j])], num[i]); } vector<int> can; for (int i = 0; i < n; i++) { int tmp = 0; for (int j = 0; j < m; j++) for (int c = 0; c < 4; c++) if (index(s[i][j]) != c) tmp = add(tmp, sum[j][c]); for (int j = 0; j < n; j++) if (i != j) tmp = sub(tmp, mul(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...