제출 #751637

#제출 시각아이디문제언어결과실행 시간메모리
751637bgnbvnbvGenetics (BOI18_genetics)C++14
100 / 100
483 ms39800 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...