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;
typedef long long ll;
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x) x.begin(), x.end()
const int M = 5007;
const ll inf = 1e18;
const ll mod = 998244353;
const double pi = acos(-1);
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
int to(char x)
{
if(x == 'A') return 0;
if(x == 'C') return 1;
if(x == 'G') return 2;
return 3;
}
ll n, m, k, a[M][M], cnt[M][4], w[M], tot;
int main()
{
cin >> n >> m >> k;
for(int i = 1; i <= n; ++i){
string s; cin >> s;
w[i] = rand();
tot += w[i];
for(int j = 1; j <= m; ++j){
a[i][j] = to(s[j - 1]);
cnt[j][a[i][j]] += w[i];
}
}
for(int i = 1; i <= n; ++i){
ll sum = 0;
for(int j = 1; j <= m; ++j) sum += tot - cnt[j][a[i][j]];
if(sum == (tot - w[i]) * k) cout << i << endl, exit(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... |