Submission #784157

#TimeUsernameProblemLanguageResultExecution timeMemory
784157raysh07Genetics (BOI18_genetics)C++17
19 / 100
2016 ms16600 KiB
#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)

genetics.cpp: In function 'void Solve()':
genetics.cpp:31:36: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   31 |    good &= (bs[i] ^ bs[x]).count() == k;
      |            ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...