Submission #676984

#TimeUsernameProblemLanguageResultExecution timeMemory
676984dooompyGenetics (BOI18_genetics)C++17
100 / 100
728 ms42620 KiB
#include "bits/stdc++.h" using namespace std; void abc() {cout << endl;} template <typename T, typename ...U> void abc(T a, U ...b) { cout << a << ' ', abc(b...); } template <typename T> void printv(T l, T r) { while (l != r) cout << *l << " \n"[++l == r]; } template <typename A, typename B> istream& operator >> (istream& o, pair<A, B> &a) { return o >> a.first >> a.second; } template <typename A, typename B> ostream& operator << (ostream& o, pair<A, B> a) { return o << '(' << a.first << ", " << a.second << ')'; } template <typename T> ostream& operator << (ostream& o, vector<T> a) { bool is = false; for (T i : a) {o << (is ? ' ' : '{'), is = true, o << i;} return o << '}'; } #ifdef local #define test(args...) abc("[" + string(#args) + "]", args) #else #define test(args...) void(0) #endif using ll = long long; string s[5000]; ll v[5000]; ll sum = 0; ll psum[5000][200]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("", "r", stdin); // freopen("", "w", stdout); int n, m, k; cin >> n >> m >> k; mt19937 mt; uniform_int_distribution<ll> rnd(0, 1e9 + 6); for (int i = 1; i <= n; i++) { cin >> s[i]; v[i] = rnd(mt); sum += v[i]; } for (int i = 0; i < m; i++) { for (auto c : {'A', 'C', 'T', 'G'}) { for (int j = 1; j <= n; j++) { if (s[j][i] == c) { psum[i][c] += v[j]; } } } } for (int i = 1; i <= n; i++) { ll tot = 0; for (int j = 0; j < m; j++) { for (auto c : {'A', 'C', 'T', 'G'}) { if (c == s[i][j]) continue; tot += psum[j][c]; } } if (tot == (sum - v[i]) *k) { cout << i << endl; return 0; } } }

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:56:29: warning: array subscript has type 'char' [-Wchar-subscripts]
   56 |                     psum[i][c] += v[j];
      |                             ^
genetics.cpp:67:32: warning: array subscript has type 'char' [-Wchar-subscripts]
   67 |                 tot += psum[j][c];
      |                                ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...