# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1010155 | alexdd | Genetics (BOI18_genetics) | C++17 | 244 ms | 36432 KiB |
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;
#define int long long
const int MOD = 1e9+9;
int n,m,k;
string s[4105];
int cnt[4105][4];
int r[4105];
mt19937 rnd(time(0));
signed main()
{
ios_base::sync_with_stdio(0);cin.tie(0);
cin>>n>>m>>k;
int tot=0;
for(int i=1;i<=n;i++)
{
cin>>s[i];
r[i] = rnd()%MOD;
tot += r[i]*k;
for(int j=0;j<m;j++)
{
if(s[i][j]=='A') s[i][j]=0;
else if(s[i][j]=='C') s[i][j]=1;
else if(s[i][j]=='G') s[i][j]=2;
else s[i][j]=3;
cnt[j][s[i][j]] += r[i];
}
}
for(int i=1;i<=n;i++)
{
int sum=0;
for(int j=0;j<m;j++)
{
for(int c=0;c<4;c++)
if(c!=s[i][j])
sum += cnt[j][c];
}
if(sum + r[i]*k == tot)
{
cout<<i;
return 0;
}
}
return 0;
}
Compilation message (stderr)
# | 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... |