# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
864403 | iskhakkutbilim | Genetics (BOI18_genetics) | C++17 | 2058 ms | 37908 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
const int N = 4100;
bitset<N+1> bits[N+1];
main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, m, k; cin >> n >> m >> k;
vector<string> a(n);
for(auto &x : a) cin >> x;
if(n <= 100 && m <= 100){
for(int i = 0;i < n; i++){
int ok = 0;
for(int j = 0;j < n; j++){
if(i == j) continue;
int c = 0;
for(int idx = 0; idx < m; idx++){
c+= a[i][idx] != a[j][idx];
}
if(c != k){
ok = 1;
break;
}
}
if(!ok){
cout << i+1;
return 0;
}
}
}else{
for(int i = 0;i < n; i++){
for(int j = 0;j < m; j++){
if(a[i][j] == 'A'){
bits[i][j] = 1;
}else{
bits[i][j] = 0;
}
}
}
for(int i = 0;i < n; i++){
int ok = 0;
for(int j = 0;j < n; j++){
if(i == j) continue;
if((bits[i] ^ bits[j]).count() != k){
ok = 1;
break;
}
}
if(!ok){
cout << i+1;
return 0;
}
}
}
return 0;
}
Compilation message (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... |