제출 #104631

#제출 시각아이디문제언어결과실행 시간메모리
104631WLZGenetics (BOI18_genetics)C++17
100 / 100
675 ms36344 KiB
#include <bits/stdc++.h> using namespace std; map<char, int> mp; int main() { ios::sync_with_stdio(false); cin.tie(0); mp['A'] = 0, mp['C'] = 1, mp['G'] = 2, mp['T'] = 3; int n, m, k; cin >> n >> m >> k; vector<string> a(n); vector<long long> w(n); iota(w.begin(), w.end(), 1); random_shuffle(w.begin(), w.end()); for (int i = 0; i < n; i++) { cin >> a[i]; } vector< vector<long long> > v(4, vector<long long>(m, 0)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { v[mp[a[i][j]]][j] += w[i]; } } for (int i = 0; i < n; i++) { long long tmp = 0; for (int j = 0; j < m; j++) { tmp += v[mp[a[i][j]]][j]; } long long exp = 0; for (int j = 0; j < n; j++) { if (j != i) { exp += w[j]; } } exp *= (long long) (m - k); exp += (long long) m * w[i]; if (tmp == exp) { 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...