Submission #693015

#TimeUsernameProblemLanguageResultExecution timeMemory
693015MilosMilutinovicGenetics (BOI18_genetics)C++17
100 / 100
772 ms36184 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, k; cin >> n >> m >> k; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; } mt19937 rng(time(0)); vector<int> val(n); for (int i = 0; i < n; i++) { val[i] = rng() % (int) 1e9; } auto Id = [&](char c) { if (c == 'A') return 0; if (c == 'G') return 1; if (c == 'C') return 2; if (c == 'T') return 3; }; vector<long long> d(n); for (int j = 0; j < m; j++) { vector<long long> f(4); for (int i = 0; i < n; i++) { f[Id(s[i][j])] += val[i]; } for (int i = 0; i < n; i++) { for (int k = 0; k < 4; k++) { if (Id(s[i][j]) != k) { d[i] += f[k]; } } } } long long sum = 0; for (int i = 0; i < n; i++) { sum += val[i]; } for (int i = 0; i < n; i++) { if (d[i] == (sum - val[i]) * k) { cout << i + 1 << '\n'; return 0; } } return 0; }

Compilation message (stderr)

genetics.cpp: In lambda function:
genetics.cpp:24:3: warning: control reaches end of non-void function [-Wreturn-type]
   24 |   };
      |   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...