이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2")
const int N = 4100 + 4;
int n, m, k;
bool done[N];
char s[N][N];
bitset<N> tmp, a[N], g[N], c[N], t[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
bool AC = true;
cin >> n >> m >> k;
for (int i = 0; i < n; ++i) {
cin >> s[i];
for (int j = 0; j < m; ++j) {
if (s[i][j] == 'A') {
a[i][j] = true;
}
else if (s[i][j] == 'G') {
g[i][j] = true;
}
else if (s[i][j] == 'C') {
c[i][j] = true;
}
else if (s[i][j] == 'T') {
t[i][j] = true;
}
}
}
for (int i = 0; i < n; ++i) {
if (done[i]) {
continue;
}
int cntOk = 0;
for (int j = i + 1; j < n; ++j) {
int cnt = 0;
tmp = a[i] & a[j];
cnt += tmp.count();
tmp = g[i] & g[j];
cnt += tmp.count();
tmp = c[i] & c[j];
cnt += tmp.count();
tmp = t[i] & t[j];
cnt += tmp.count();
// cout << i + 1 << ' ' << j + 1 << ' ' << cnt << '\n';
if (m - cnt == k) {
++cntOk;
}
else {
done[j] = true;
}
}
if (cntOk == n - i - 1) {
cout << i + 1;
return 0;
}
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
genetics.cpp: In function 'int main()':
genetics.cpp:21:10: warning: unused variable 'AC' [-Wunused-variable]
21 | bool AC = true;
| ^~| # | 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... |