Submission #140807

#TimeUsernameProblemLanguageResultExecution timeMemory
140807MinnakhmetovGenetics (BOI18_genetics)C++14
27 / 100
2087 ms3192 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define all(aaa) aaa.begin(), aaa.end() const int N = 4100; string s[N]; int a[N]; bool banned[N]; signed main() { #ifdef HOME freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); int n, m, k; cin >> n >> m >> k; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); for (int i = 0; i < n; i++) { a[i] = i; while (s[i].empty()) getline(cin, s[i]); } shuffle(a, a + n, rng); for (int h = 0; h < n; h++) { int i = a[h]; if (banned[i]) continue; bool ok = true; for (int j = 0; j < n; j++) { if (i != j) { int d = 0; for (int k = 0; k < m; k++) { if (s[i][k] != s[j][k]) d++; } if (d != k) { banned[j] = 1; ok = false; } } } if (ok) { cout << i + 1; return 0; } } 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...