This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define dbg() cerr <<
#define name(x) (#x) << ": " << (x) << ' ' <<
using namespace std;
int GetChar(char c) {
return (c == 'A') * 0 +
(c == 'C') * 1 +
(c == 'G') * 2 +
(c == 'T') * 3;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, m, k; cin >> n >> m >> k; cin.get();
vector<vector<long long>> sum(m, vector<long long>(4));
vector<string> v(n);
vector<int> val(n);
long long total_val = 0;
for (int i = 0; i < n; ++i) {
getline(cin, v[i]);
val[i] = rng();
total_val += val[i];
for (int j = 0; j < m; ++j) {
sum[j][GetChar(v[i][j])] += val[i];
}
}
for (int i = 0; i < n; ++i) {
long long hash = 0;
for (int j = 0; j < m; ++j) {
for (int c = 0; c < 4; ++c) {
if (c == GetChar(v[i][j])) continue;
hash += sum[j][c];
}
}
if (hash == 1LL * k * (total_val - val[i])) {
cout << 1 + i << endl;
return 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |