Submission #416804

#TimeUsernameProblemLanguageResultExecution timeMemory
416804SirCovidThe19thGenetics (BOI18_genetics)C++14
100 / 100
723 ms47952 KiB
#include <bits/stdc++.h> using namespace std; long long n, m, k, idx[100], r[4105], hsh[4105][4], tot; string s[4105]; int main() { mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); cin >> n >> m >> k; idx['A'] = 0; idx['G'] = 1; idx['C'] = 2; idx['T'] = 3; for (int i = 0; i < n; i++){ cin >> s[i]; r[i] = uniform_int_distribution<long long>(1e3, 1e10)(rng); tot += r[i]; for (int j = 0; j < m; j++) hsh[j][idx[s[i][j]]] += r[i]; } for (int i = 0; i < n; i++){ long long val = 0; for (int j = 0; j < m; j++) val += tot-hsh[j][idx[s[i][j]]]; if (val == k*(tot-r[i])){ cout<<i+1; break; } } }

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:13:55: warning: array subscript has type 'char' [-Wchar-subscripts]
   13 |         for (int j = 0; j < m; j++) hsh[j][idx[s[i][j]]] += r[i];
      |                                                       ^
genetics.cpp:17:66: warning: array subscript has type 'char' [-Wchar-subscripts]
   17 |         for (int j = 0; j < m; j++) val += tot-hsh[j][idx[s[i][j]]];
      |                                                                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...