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>
typedef long long ll;
using namespace std;
string s[4100];
ll rnd[4100], tot, sm[4100][4];
int idx(char c) {
if (c == 'A') return 0;
if (c == 'G') return 1;
if (c == 'C') return 2;
return 3;
}
int main() {
cin.tie(0)->sync_with_stdio(0);
int n, m, k;
cin >> n >> m >> k;
for (int i = 0; i < n; i++) {
rnd[i] = rand();
tot += rnd[i];
cin >> s[i];
for (int j = 0; j < m; j++) sm[j][idx(s[i][j])] += rnd[i];
}
for (int i = 0; i < n; i++) {
ll hsh = 0;
for (int j = 0; j < m; j++) hsh += tot - sm[j][idx(s[i][j])];
if (hsh == k * (tot - rnd[i])) return cout << i + 1, 0;
}
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... |