# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
784157 | raysh07 | Genetics (BOI18_genetics) | C++17 | 2016 ms | 16600 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 INF (int)1e18
mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count());
const int N = 4105;
bitset <N> bs[N];
void Solve()
{
int n, m, k; cin >> n >> m >> k;
for (int i = 0; i < n; i++){
string s; cin >> s;
for (int j = 0; j < m; j++){
if (s[j] == 'A') bs[i].set(j);
}
}
vector <int> perm;
for (int i = 0; i < n; i++) perm.push_back(i);
srand(69);
random_shuffle(perm.begin(), perm.end());
for (auto x : perm){
bool good = true;
for (int i = 0; i < n; i++) if (i != x){
good &= (bs[i] ^ bs[x]).count() == k;
if (!good) break;
}
if (good){
cout << x + 1 << "\n";
return;
}
}
}
int32_t main()
{
auto begin = std::chrono::high_resolution_clock::now();
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;
// freopen("in", "r", stdin);
// freopen("out", "w", stdout);
// cin >> t;
for(int i = 1; i <= t; i++)
{
//cout << "Case #" << i << ": ";
Solve();
}
auto end = std::chrono::high_resolution_clock::now();
auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin);
cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n";
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... |