# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
825413 | QwertyPi | Genetics (BOI18_genetics) | C++14 | 2037 ms | 5296 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4100 + 11;
bitset<8200> A[4100];
bitset<8200> B, F1, F2;
int f(char c){
if(c == 'A') return 0;
if(c == 'C') return 1;
if(c == 'G') return 2;
if(c == 'T') return 3;
}
bool fail[MAXN];
int32_t main(){
random_device rd;
mt19937 rng(rd());
int n, m, k; cin >> n >> m >> k;
for(int j = 0; j < m; j++){
F1.set(j * 2, 1); F2.set(j * 2 + 1, 1);
}
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
char c; cin >> c;
int x = f(c);
A[i].set(j * 2, x % 2);
A[i].set(j * 2 + 1, x / 2);
}
}
vector<int> p(n); for(int i = 0; i < n; i++) p[i] = i;
for(int i = 0; i < n; i++) swap(p[i], p[rng() % (i + 1)]);
for(int i = 0; i < n; i++){
if(fail[p[i]]) continue;
bool ok = true;
for(int j = 0; j < n; j++){
if(i == j) continue;
B = A[p[i]] ^ A[p[j]];
B = (B & F1) | ((B & F2) >> 1);
if(B.count() != k){
fail[p[i]] = fail[p[j]] = true;
ok = false;
break;
}
}
if(ok){
cout << p[i] + 1 << endl;
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... |