제출 #1228517

#제출 시각아이디문제언어결과실행 시간메모리
1228517quanndGenetics (BOI18_genetics)C++20
0 / 100
799 ms6412 KiB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define int long long
#define pii pair <ll, ll>
#define fi first
#define se second

const ll N = 4105, inf = 1e18, mod = 1e9 + 7, block = 320;

int n, m, k;
string a[N];
bitset <N> pre[N][4];

int char_to_int(char x) {
	if (x == 'A') return 0;
	if (x == 'C') return 1;
	if (x == 'G') return 2;
	if (x == 'T') return 3; 
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m >> k;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < m; j++) {
			pre[i][char_to_int(a[i][j])][j] = 1;
		}
	}
	for (int i = 1; i <= n; i++) {
		bool check = true;
		for (int j = 1; j < n; j++) {
			int sum = 0;
			for (int x = 0; x < 4; x++) {
				int diff = (pre[i][x] ^ pre[j][x]).count();
				sum += diff;
			}
			sum /= 2;
			if (sum != k) {
				check = false;
				break;
			}
		}
		if (!check) continue;
		for (int j = i + 1; j <= n; j++) {
			int sum = 0;
			for (int x = 0; x < 4; x++) {
				int diff = (pre[i][x] ^ pre[j][x]).count();
				sum += diff;
			}
			sum /= 2;
			if (sum != k) {
				check = false;
				break;
			}
		}
		if (check) {
			cout << i;
			break;
		}
	}
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

genetics.cpp: In function 'long long int char_to_int(char)':
genetics.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type]
   22 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...