Submission #932703

#TimeUsernameProblemLanguageResultExecution timeMemory
932703WongChun1234Genetics (BOI18_genetics)C++14
46 / 100
2039 ms68492 KiB
#include<bits/stdc++.h> using namespace std; const int N=4150; int n,m,k,bad[N],cnt[N][N]; string s; bitset<8200> bs1[N],bs2[N]; int main(){ cin.tie(0)->sync_with_stdio(0); cin>>n>>m>>k; for (int i=1;i<=n;i++){ cin>>s; for (int j=0;j<m;j++) bs1[i][j]=(s[j]=='A'||s[j]=='C'),bs2[i][j]=(s[j]=='A'||s[j]=='G'); } for (int i=1;i<=n;i++) for (int j=1;j<=n;j++) cnt[i][j]=-1; for (int i=1;i<=n;i++){ if (bad[i]) continue; for (int j=1;j<=n;j++){ if (i==j) continue; if (cnt[j][i]==-1) cnt[i][j]=((bs1[i]^bs1[j])|(bs2[i]^bs2[j])).count(); else cnt[i][j]=cnt[j][i]; if (cnt[i][j]!=k){ bad[j]=bad[i]=1; goto skip; } } cout<<i<<"\n"; return 0; skip:; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...