제출 #373710

#제출 시각아이디문제언어결과실행 시간메모리
373710dolphingarlicGenetics (BOI18_genetics)C++14
100 / 100
287 ms24172 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; string s[4100]; ll rnd[4100], tot, sm[4100][4]; int idx(char c) { if (c == 'A') return 0; if (c == 'G') return 1; if (c == 'C') return 2; return 3; } 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]; cin >> s[i]; for (int j = 0; j < m; j++) sm[j][idx(s[i][j])] += rnd[i]; } for (int i = 0; i < n; i++) { ll hsh = 0; for (int j = 0; j < m; j++) hsh += tot - sm[j][idx(s[i][j])]; 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...