# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1228522 | quannd | Genetics (BOI18_genetics) | C++20 | 2095 ms | 7660 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 < i; 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) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |