Submission #878238

#TimeUsernameProblemLanguageResultExecution timeMemory
878238vjudge1Genetics (BOI18_genetics)C++17
46 / 100
2009 ms34544 KiB
#include <bits/stdc++.h> using namespace std; const int N = 4100 + 10; int n, m, k, cnt[N]; string s[N]; bitset<N> a[N]; int main() { ios:: sync_with_stdio(0), cin.tie(0); cin >> n >> m >> k; for (int i = 0; i < n; i++) cin >> s[i]; if (n >= 1801) { for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) if (s[i][j] == 'C') a[i][j] = 1; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) if ((a[i] ^ a[j]).count() == k) cnt[i]++, cnt[j]++; } else { for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) { int tmp = 0; for (int k = 0; k < s[i].size(); k++) if (s[i][k] != s[j][k]) tmp++; if (tmp == k) cnt[i]++, cnt[j]++; } } for (int i = 0; i < n; i++) if (cnt[i] == n - 1) { cout << i + 1 << '\n'; break; } return 0; }

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:20:43: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |                 if ((a[i] ^ a[j]).count() == k) cnt[i]++, cnt[j]++;
      |                     ~~~~~~~~~~~~~~~~~~~~~~^~~~
genetics.cpp:26:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |                 for (int k = 0; k < s[i].size(); k++)
      |                                 ~~^~~~~~~~~~~~~
genetics.cpp:31:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   31 |     for (int i = 0; i < n; i++)
      |     ^~~
genetics.cpp:36:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   36 |  return 0;
      |  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...