제출 #917105

#제출 시각아이디문제언어결과실행 시간메모리
917105406Genetics (BOI18_genetics)C++17
100 / 100
83 ms36396 KiB
#include <bits/stdc++.h> #define int int64_t #define FOR(i, a, b) for (int i = (a); i < (b); ++i) using namespace std; using ar = array<int, 2>; const int64_t INF = 1ll << 60; const int N = 4200; int n, m, k, w[N], dp[N][4]; string s[N]; int T(char c) { switch (c) { case 'A': return 0; case 'C': return 1; case 'G': return 2; case 'T': return 3; } return -1; } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m >> k; FOR (i, 0, n) cin >> s[i]; mt19937 rng((int64_t) new char); FOR(i, 0, n) w[i] = rng(); int sum = accumulate(w, w + n, 0ll); FOR(i, 0, n) { FOR(j, 0, m) dp[j][T(s[i][j])] += w[i]; } FOR(i, 0, n) { int ans = 0; FOR(j, 0, m) ans += sum - dp[j][T(s[i][j])]; if (ans == k * (sum - w[i])) { cout << i + 1; return 0; } } assert(false); 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...