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>
using namespace std;
const int N = 4107;
int n, m, k;
string s[N];
long long x[N];
long long f[N][4];
long long g[N];
long long X = 0;
int type(char c) {
if (c == 'A') return 0;
if (c == 'C') return 1;
if (c == 'G') return 2;
return 3;
}
int main() {
srand(time(NULL));
ios_base::sync_with_stdio(false);
cin >> n >> m >> k;
for (int i = 0; i < n; ++i) {
cin >> s[i];
x[i] = rand();
X += x[i];
for (int j = 0; j < m; ++j) f[j][type(s[i][j])] += x[i];
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
int t = type(s[i][j]);
for (int tt = 0; tt < 4; ++tt) {
if (tt != t) g[i] += f[j][tt];
}
}
if (g[i] == k * (X - x[i])) return cout << i + 1 << '\n',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... |