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>
#define TASKNAME "codeforce"
#define pb push_back
#define pli pair<int,int>
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
using ll=long long;
const ll maxN=2e5;
const ll inf=1e18;
const ll mod=1e9+7;
ll n,m;
string s[maxN];
ll pw[maxN];
ll val[maxN][4];
char c[]={'A','C','G','T'};
ll k;
ll base=311;
void solve()
{
cin >> n >> m >> k;
for(int i=1;i<=n;i++) cin >> s[i],s[i]=' '+s[i];
pw[0]=1;
for(int i=1;i<=n;i++) pw[i]=pw[i-1]*base%mod;;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
for(int d=0;d<4;d++)
{
if(s[i][j]!=c[d])
{
val[j][d]+=pw[i];
val[j][d]%=mod;
}
}
}
}
for(int i=1;i<=n;i++)
{
ll sum=0,check=0;
for(int j=1;j<=n;j++)
{
if(j!=i)
{
sum+=pw[j]*k%mod;
sum%=mod;
}
}
for(int j=1;j<=m;j++)
{
for(int d=0;d<4;d++)
{
if(s[i][j]==c[d]) check+=val[j][d],check%=mod;
}
}
if(check==sum)
{
cout << i;
}
}
}
int main()
{
fastio
//freopen(TASKNAME".INP","r",stdin);
//freopen(TASKNAME".OUT","w",stdout);
solve();
}
# | 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... |