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 speed ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
namespace{using namespace std;}
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MAX=4200+10,P=1e9+7;
const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f;
int n,m,k;
vector<int> s[MAX];
ll cnt[MAX][4];
ll w[MAX];
int main() {
speed;
cin>>n>>m>>k;
memset(cnt,0,sizeof(cnt));
mt19937 rnd(time(0)+3457634);
uniform_int_distribution<int> gen(1,100000);
ll ttl=0;
for (int i=1;i<=n;i++) {
w[i]=gen(rnd);
ttl+=w[i];
s[i].resize(m);
for (int j=0;j<m;j++) {
char c;
cin>>c;
if (c=='A') s[i][j]=0;
if (c=='T') s[i][j]=1;
if (c=='C') s[i][j]=2;
if (c=='G') s[i][j]=3;
cnt[j][s[i][j]]+=w[i];
}
}
int ans=0;
for (int i=1;i<=n;i++) {
ll now=0;
for (int j=0;j<m;j++) {
now+=cnt[j][0]+cnt[j][1]+cnt[j][2]+cnt[j][3];
now-=cnt[j][s[i][j]];
}
if (now==(ttl-w[i])*k) {
ans=i;
break;
}
}
cout<<ans<<"\n";
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... |