제출 #123612

#제출 시각아이디문제언어결과실행 시간메모리
123612MoNsTeR_CuBeGenetics (BOI18_genetics)C++17
27 / 100
2081 ms12408 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long 

int getIndex(char c){
	if(c == 'A') return 0;
	if(c == 'C') return 1;
	if(c == 'G') return 2;
	return 3;
}

vector< vector< vector< int > > > opti(4, vector< vector< int > > (65, vector< int >(4500)));

int compare(int a, int b){
	int tot = 0;
	for(int i = 0; i < 65; i++){
		for(int j = 0; j < 4; j++){
			tot += __builtin_popcountll(opti[j][i][a] ^ opti[j][i][b]);
		}
	}
	return tot/2;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m, K;
	cin >> n >> m >> K;
	
	vector< string > v(n);
	
	
	
	for(int i = 0; i < n; i++){
		cin >> v[i];
	
		vector< vector< int > > nb(4, vector< int >(65));
		for(int j = 1; j <= 65; j++){
			for(int k = (j-1)*64; k < min(j*64, m); k++){
				nb[getIndex(v[i][k])][j-1] ^= (1LL<<(63-k%64));
			}
		}
		for(int k = 0; k < 4; k++){
			for(int l = 0; l < 65; l++){
				opti[k][l][i] = nb[k][l];
			}
		}
	}
	/*
	for(int i = 0; i < n; i++){
		cout << "NUMBER " << i << endl;
		for(int j = 0; j < 4; j++){
			cout << opti[j][0][i] << endl;
		}
	}*/

	for(int i = 0; i < n; i++){
		bool verif = true;
		for(int j = 0; j < n; j++){
			if(j == i) continue;
			if(compare(i,j) != K){
				verif = false;
				break;
			}
		}
		if(verif){
			cout << i+1 << endl;
			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...