Submission #121014

#TimeUsernameProblemLanguageResultExecution timeMemory
121014IOrtroiiiGenetics (BOI18_genetics)C++14
100 / 100
394 ms21368 KiB
#include <bits/stdc++.h> using namespace std; const int N = 4107; int n, m, k; string s[N]; long long x[N]; long long f[N][4]; long long g[N]; long long X = 0; int type(char c) { if (c == 'A') return 0; if (c == 'C') return 1; if (c == 'G') return 2; return 3; } int main() { srand(time(NULL)); ios_base::sync_with_stdio(false); cin >> n >> m >> k; for (int i = 0; i < n; ++i) { cin >> s[i]; x[i] = rand(); X += x[i]; for (int j = 0; j < m; ++j) f[j][type(s[i][j])] += x[i]; } for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { int t = type(s[i][j]); for (int tt = 0; tt < 4; ++tt) { if (tt != t) g[i] += f[j][tt]; } } if (g[i] == k * (X - x[i])) return cout << i + 1 << '\n',0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...