Submission #530676

#TimeUsernameProblemLanguageResultExecution timeMemory
530676OttoTheDinoGenetics (BOI18_genetics)C++17
100 / 100
412 ms148524 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i,s,e) for (ll i = s; i <= e; ++i) #define rrep(i,s,e) for (ll i = s; i >= e; --i) #define pb push_back #define pf push_front #define fi first #define se second #define all(a) a.begin(), a.end() typedef long long ll; typedef pair<ll, ll> ii; typedef vector<ii> vii; typedef vector<ll> vi; typedef vector<double> vd; typedef vector<string> vs; typedef vector<ll> vll; ll rand (ll a, ll b) { return a + rand() % (b-a+1); } int main() { ios::sync_with_stdio(0); cin.tie(0); srand(time(0)); ll n, m, K; cin >> n >> m >> K; ll w[n], col_sum[m][4] = {}, w_sum = 0; rep (i,0,n-1) { w[i] = rand(1, 1000000); w_sum += w[i]; } unordered_map<char, ll> mp; mp['A'] = 0; mp['C'] = 1; mp['G'] = 2; mp['T'] = 3; ll a[n][m]; rep (i,0,n-1) { string s; cin >> s; rep (j,0,m-1) { a[i][j] = mp[s[j]]; col_sum[j][a[i][j]] += w[i]; } } rep (i,0,n-1) { ll tot = 0; rep (j,0,m-1) { rep (k,0,3) { if (k==a[i][j]) tot += col_sum[j][k]-w[i]; else tot -= col_sum[j][k]; } } if (tot==(m-2*K)*(w_sum-w[i])) { cout << i+1 << "\n"; break; } } 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...