제출 #447219

#제출 시각아이디문제언어결과실행 시간메모리
447219prvocisloGenetics (BOI18_genetics)C++17
100 / 100
382 ms83080 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll my_rand() { return (rand() * 100000ll + rand() * 100ll + (ll)rand()); } const string dna = "ACGT"; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, k; cin >> n >> m >> k; vector<vector<int> > v(n, vector<int>(m)); vector<vector<ll> > sum(m, vector<ll>(4, 0)); vector<ll> w(n); ll ans = 0; for (int i = 0; i < n; i++) { w[i] = my_rand(); string s; cin >> s; for (int j = 0; j < m; j++) { v[i][j] = find(dna.begin(), dna.end(), s[j]) - dna.begin(); for (int c = 0; c < 4; c++) if (c ^ v[i][j]) sum[j][c] += w[i]; } ans += w[i] * (ll)k; } for (int i = 0; i < n; i++) { ll my = w[i] * (ll)k; for (int j = 0; j < m; j++) my += sum[j][v[i][j]]; if (my == ans) { cout << i+1 << "\n"; return 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...