Submission #566251

#TimeUsernameProblemLanguageResultExecution timeMemory
566251minhcoolGenetics (BOI18_genetics)C++17
27 / 100
2079 ms26892 KiB
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

const int N = 4005;

const int oo = 1e18 + 7, mod = 1e9 + 7;

int n, m, K;
int a[N][N];

int ha[256];

int tol[N];

void process(){
	ha[0] = 1, ha[6] = 2, ha['T' - 'A'] = 3, ha[2] = 4;
	cin >> n >> m >> K;
	//cout << n << " " << m << " " << K << "\n";
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			char c;
			cin >> c;
			a[i][j] = ha[c - 'A'];
			//cout << a[i][j] << "\n";
		}
	}
	for(int i = 1; i <= n; i++){
		for(int j = i + 1; j <= n; j++){
			int sum = 0;
			for(int k = 1; k <= m; k++) sum += (a[i][k] != a[j][k]);
			//cout << i << " " << j << " " << sum << "\n";
			if(sum == K){
				tol[i]++, tol[j]++;
			}
		}
	}
	for(int i = 1; i <= n; i++) if(tol[i] == (n - 1)) cout << i << "\n";
	int cnt = 0;
  /*
	for(int i = 1; i <= n; i++){
		if(tol[i] * 2 >= n) cnt++;
	}
	assert(cnt <= n/2);*/
}

signed main(){
	ios_base::sync_with_stdio(0);
	process();
}

Compilation message (stderr)

genetics.cpp: In function 'void process()':
genetics.cpp:50:6: warning: unused variable 'cnt' [-Wunused-variable]
   50 |  int cnt = 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...