| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 689890 | NK_ | Genetics (BOI18_genetics) | C++17 | 21 ms | 6096 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.
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
using str = string;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9+7;
int main() {
cin.tie(0)->sync_with_stdio(0);
int N, M, K; cin >> N >> M >> K;
vector<str> A(N); for(auto& x : A) cin >> x;
vector<int> ans(N); iota(begin(ans), end(ans), 0);
auto rnd = [&]() {
return (rng() * 1LL * rng()) % MOD;
};
for(int t = 0; t < 100; t++) {
int n = size(ans);
int I = (rnd() % n);
vector<int> pos;
for(int k = 0; k < N; k++) {
int c = 0;
for(int j = 0; j < M; j++) {
if (A[k][j] != A[I][j]) c++;
}
if (c == K) pos.push_back(k);
}
if (size(pos) == N-1) {
cout << I+1 << nl;
return 0;
}
int j = 0;
vector<int> nans = {};
for(int i = 0; i < size(pos); i++) if (j < size(ans) && pos[i] == ans[j]) {
nans.push_back(pos[i]); j++;
}
ans.swap(nans);
}
assert(false);
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... | ||||
