Submission #442066

#TimeUsernameProblemLanguageResultExecution timeMemory
442066abc864197532Genetics (BOI18_genetics)C++17
0 / 100
55 ms5748 KiB
#include <bits/stdc++.h> using namespace std; #define lli long long int #define X first #define Y second #define pb push_back #define eb emplace_back #define mp make_pair #define pii pair<int, int> #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define test(args...) abc("[" + string(#args) + "]", args) void abc() {cerr << endl;} template <typename T, typename ...U> void abc(T a, U ...b) { cerr << a << ' ', abc(b...); } template <typename T> void printv(T l, T r) { while (l != r) cout << *l << " \n"[++l == r]; } const int mod = 1e9 + 7, N = 200000; int chg(char c) { if (c == 'A') return 0; if (c == 'C') return 1; if (c == 'T') return 2; return 3; } int main () { ios::sync_with_stdio(false); cin.tie(0); srand(864197532); int n, m, k; cin >> n >> m >> k; vector <string> s(n); vector <int> id(n); for (int i = 0; i < n; ++i) cin >> s[i], id[i] = rand(); vector <vector <int>> cnt(m, vector <int>(4, 0)); for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { cnt[j][chg(s[i][j])] += id[i]; } } lli sum = accumulate(all(id), 0ll); for (int i = 0; i < n; ++i) { lli cur = 0; for (int j = 0; j < m; ++j) { for (int ii = 0; ii < 4; ++ii) if (ii != chg(s[i][j])) { cur += cnt[j][ii]; } } if (cur == (sum - id[i]) * k) return cout << i + 1 << endl, 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...