# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
94321 | dalgerok | Genetics (BOI18_genetics) | C++17 | 156 ms | 6520 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>
#define int long long
using namespace std;
const int N = 4105;
const char letters[] = {'A', 'C', 'G', 'T'};
int n, m, k, val[N], sum, d[N][4];
char a[N][N];
inline int rnd(){
int cur = 0;
cur ^= (rand() << 0);
cur ^= (rand() << 15);
cur ^= (rand() << 30);
cur ^= (rand() << 45);
return cur;
}
main(){
srand(time(nullptr));
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> m >> k;
for(int i = 1; i <= n; i++){
val[i] = rnd();
sum += val[i];
for(int j = 1; j <= m; j++){
cin >> a[i][j];
}
}
for(int it = 0; it < 4; it++){
for(int j = 1; j <= n; j++){
for(int i = 1; i <= n; i++){
if(a[i][j] == letters[it]){
d[j][it] += val[i];
}
}
}
}
for(int i = 1; i <= n; i++){
int cur = 0;
for(int j = 1; j <= m; j++){
for(int l = 0; l < 4; l++){
if(a[i][j] != letters[l]){
cur += d[j][l];
}
}
}
if(cur == k * (sum - val[i])){
return cout << i, 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... |