제출 #1238671

#제출 시각아이디문제언어결과실행 시간메모리
1238671nlsosadGenetics (BOI18_genetics)C++20
0 / 100
26 ms6248 KiB
#include <bits/stdc++.h>
#define int short
using namespace std;
string s[4100];
bitset<4100> bs[4100][4]; // a c g t
char luu[4] = {'A', 'C', 'G', 'T'};
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m, k;
	cin >> n >> m >> k;
	for (int i = 0;i<n;++i){
		cin >> s[i];
		for (int j= 0;j<s[i].size();++j){
			// cout << s[i][j] << '\n';
			for (int p = 0;p<4;++p){
				if(s[i][j]==luu[p]){
					bs[i][p].set(j);
				}
			}
		}
	}
	for (int i = 0;i<n;++i){
		bool c = true;
		for (int j = 0;j<n;++j){
			if(i!=j){
				int tmp = 0;
				tmp += (bs[i][0] ^ bs[j][0]).count();
				if(tmp>k){
					c = false;
					break;
				}
				tmp += (bs[i][1] ^ bs[j][1]).count();
				if(tmp>k){
					c = false;
					break;
				}
				tmp += (bs[i][2] ^ bs[j][2]).count();
				if(tmp>k){
					c = false;
					break;
				}
				tmp += (bs[i][3] ^ bs[j][3]).count();
				if(tmp>k){
					c = false;
					break;
				}
				tmp/=2;
				// cout << i << ' '<< j << ' ' << tmp << '\n';
				if(tmp!=k){
					c = false;
					break;
				}
			}
		}
		if(c){
			cout << i+1;
			return 0;
		}
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...