# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1034592 | anango | Genetics (BOI18_genetics) | C++17 | 959 ms | 3164 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;
mt19937 rng;
int INF = 1LL<<30;
int n,m,k;
int isvalid(int a, int b) {
//is a/b close enough to k/m (statistically)
if (b<400) return 1; //small sample size
int maxdelta = sqrt(b)+2;
maxdelta*=(b+m);
int realdelta = abs(b*k-a*m);
return realdelta<=maxdelta;
}
int match(string &s1, string &s2) {
int ct=0;
for (int i=0; i<m; i++) {
ct+=s1[i]!=s2[i];
if (!isvalid(ct,i+1)) return -1;
}
return ct;
}
signed main() {
/*#ifndef ONLINE_JUDGE
// for getting input from input.txt
freopen("input.txt", "r", stdin);
# | 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... |