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;
#define _for(i, a, b) for (int i = (a); i < (int)(b); ++i)
using namespace std;
const int NN = 4100 + 4;
int V[NN][NN];
LL Sum[NN][4], W[NN];
LL randl() { return ((LL)rand() << 32) + rand(); }
map<char, int> CM = {{'A', 0}, {'C', 1}, {'G', 2}, {'T', 3}};
int main() {
ios::sync_with_stdio(false), cin.tie(0);
LL n, m, k, ans = 0;
cin >> n >> m >> k;
string s;
_for(i, 0, n) {
W[i] = randl(), cin >> s;
_for(j, 0, m) {
int &v = V[i][j];
v = CM[s[j]];
for (int c = 0; c < 4; c++)
if (c != v)
Sum[j][c] += W[i];
}
ans += W[i] * k;
}
_for(i, 0, n) {
LL s = W[i] * k;
_for(j, 0, m) s += Sum[j][V[i][j]];
if (s == ans) {
cout << i + 1 << endl;
break;
}
}
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... |