Submission #373706

#TimeUsernameProblemLanguageResultExecution timeMemory
373706dolphingarlicGenetics (BOI18_genetics)C++14
100 / 100
380 ms82848 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; int idx[4100][4100]; ll rnd[4100], tot, sm[4100][4]; int main() { cin.tie(0)->sync_with_stdio(0); int n, m, k; cin >> n >> m >> k; for (int i = 0; i < n; i++) { rnd[i] = rand(); tot += rnd[i]; string s; cin >> s; for (int j = 0; j < m; j++) { switch (s[j]) { case 'A': idx[i][j] = 0; sm[j][0] += rnd[i]; break; case 'G': idx[i][j] = 1; sm[j][1] += rnd[i]; break; case 'C': idx[i][j] = 2; sm[j][2] += rnd[i]; break; default: idx[i][j] = 3; sm[j][3] += rnd[i]; } } } for (int i = 0; i < n; i++) { ll hsh = 0; for (int j = 0; j < m; j++) for (int c = 0; c < 4; c++) if (c != idx[i][j]) hsh += sm[j][c]; if (hsh == k * (tot - rnd[i])) return cout << i + 1, 0; } return 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...