Submission #524665

#TimeUsernameProblemLanguageResultExecution timeMemory
524665Yazan_AlattarGenetics (BOI18_genetics)C++14
100 / 100
671 ms164932 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define F first #define S second #define pb push_back #define endl "\n" #define all(x) x.begin(), x.end() const int M = 5007; const ll inf = 1e18; const ll mod = 998244353; const double pi = acos(-1); const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1}; int to(char x) { if(x == 'A') return 0; if(x == 'C') return 1; if(x == 'G') return 2; return 3; } ll n, m, k, a[M][M], cnt[M][4], w[M], tot; int main() { cin >> n >> m >> k; for(int i = 1; i <= n; ++i){ string s; cin >> s; w[i] = rand(); tot += w[i]; for(int j = 1; j <= m; ++j){ a[i][j] = to(s[j - 1]); cnt[j][a[i][j]] += w[i]; } } for(int i = 1; i <= n; ++i){ ll sum = 0; for(int j = 1; j <= m; ++j) sum += tot - cnt[j][a[i][j]]; if(sum == (tot - w[i]) * k) cout << i << endl, exit(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...