Submission #878102

#TimeUsernameProblemLanguageResultExecution timeMemory
878102vjudge1Genetics (BOI18_genetics)C++17
46 / 100
2088 ms24928 KiB
#include <bits/stdc++.h>
using namespace std;

const int N = 4000;

int n, m, k, cnt[N];
string s[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];
    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:16:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |             for (int k = 0; k < s[i].size(); k++)
      |                             ~~^~~~~~~~~~~~~
genetics.cpp:20:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   20 |     for (int i = 0; i < n; i++)
      |     ^~~
genetics.cpp:25:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   25 |  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...