이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
bitset<4101> A [4101], C [4101], T [4101], G [4101];
int main () {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m, k;
cin >> n >> m >> k;
if (n <= 100) {
k = m - k;
for (int i = 0; i < n; i++) {
string w;
cin >> w;
for (int j = 0; j < (int) w.size(); j++) {
char to = w[j];
if (to == 'A') A[i][j] = 1;
if (to == 'C') C[i][j] = 1;
if (to == 'T') T[i][j] = 1;
if (to == 'G') G[i][j] = 1;
}
}
bitset<4101> diff;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i == j) continue;
diff = A[i] & A[j];
diff |= C[i] & C[j];
diff |= T[i] & T[j];
diff |= G[i] & G[j];
if (diff.count() != k) goto fimA;
}
cout << i + 1 << '\n';
return 0;
fimA:;
}
} else {
bitset<4101> g [4101];
for (int i = 0; i < n; i++) {
string w;
cin >> w;
for (int j = 0; j < (int) w.size(); j++) {
char to = w[j];
assert (to != 'T');
assert (to != 'G');
g[i][j] = (to == 'A');
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i == j) continue;
bitset<4101> cur = (g[i] ^ g[j]);
int diff = cur.count();
if (diff != k) goto fimB;
}
cout << i + 1 << '\n';
return 0;
fimB:;
}
return 0;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
genetics.cpp: In function 'int main()':
genetics.cpp:37:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (diff.count() != k) goto fimA;
~~~~~~~~~~~~~^~~~
# | 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... |