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 = 4105;
int n, m, k, sum[N], val[N], f[4][N];
string a[N];
int toint (char c) {
if (c == 'A') return 0;
if (c == 'C') return 1;
if (c == 'G') return 2;
return 3;
}
int main(){
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
cin >> n >> m >> k;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n; i++) val[i] = rd() % 100000 + 1;
for (int i = 0; i < m; i++) {
for (int j = 1; j <= n; j++) {
f[toint(a[j][i])][i] += val[j];
}
}
for (int i = 1; i <= n; i++) {
for (int j = 0; j < m; j++) {
for (int k = 0; k < 4; k++) {
if (k != toint(a[i][j])) sum[i] += f[k][j];
}
}
int cur = 0;
for (int j = 1; j <= n; j++) if (i != j) cur += val[j];
if (sum[i] == k * cur) return cout << i, 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... |