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>
#include<fstream>
using namespace std;
ifstream fin("VNOICUP.INP");
ofstream fout("VNOICUP.OUT");
#define sz(a) (int)a.size()
#define ll long long
#define pb push_back
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
#define ld long double
#define vt vector
#include<fstream>
#define fi first
#define se second
#define pll pair<ll, ll>
#define pii pair<int, int>
const ld PI = 3.14159265359;
using u128 = __uint128_t;
//const int x[4] = {1, -1, 0, 0};
//const int y[4] = {0, 0, 1, -1};
const ll mod = 998244353;
const int mxn = 4105, mxq = 2e5 + 5, sq = 400, mxv = 2e7 + 5;
//const int base = (1 << 18);
const ll inf = 1e9, neg = -69420;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rr(ll l, ll r){
return(uniform_int_distribution<ll>(l, r)(rng));
}
int n, m, k;
ll val[mxn + 1], sm[mxn + 1][4];
char a[4105][4105];
int mp[2007];
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
mp['A'] = 0; mp['C'] = 1; mp['G'] = 2; mp['T'] = 3;
ll tot = 0;
cin >> n >> m >> k;
for(int i = 1; i <= n; i++){
val[i] = rr(1, 1e10); tot += val[i];
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
cin >> a[i][j];
sm[j][mp[a[i][j]]] += val[i];
}
}
for(int i = 1; i <= n; i++){
ll cand = 0;
for(int j = 1; j <= m; j++){
cand += tot - sm[j][mp[a[i][j]]];
}
if(cand == (tot - val[i]) * k){
cout << i;
return(0);
}
}
return(0);
}
Compilation message (stderr)
genetics.cpp: In function 'int main()':
genetics.cpp:45:28: warning: array subscript has type 'char' [-Wchar-subscripts]
45 | sm[j][mp[a[i][j]]] += val[i];
| ~~~~~~^
genetics.cpp:51:42: warning: array subscript has type 'char' [-Wchar-subscripts]
51 | cand += tot - sm[j][mp[a[i][j]]];
| ~~~~~~^
# | 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... |