Submission #566285

#TimeUsernameProblemLanguageResultExecution timeMemory
566285hohohahaGenetics (BOI18_genetics)C++14
27 / 100
2056 ms4512 KiB
#include<bits/stdc++.h> using namespace std; #define fori(i, l, r) for(int i = (int) (l); i <= (int) (r); i++) #define ford(i, r, l) for(int i = (int) (r); i >= (int) (l); i--) #define ii pair<int, int> #define fi first #define se second #define vi vector<int> #define eb emplace_back #define sp ' ' #define endl '\n' mt19937 rng(chrono::steady_clock().now().time_since_epoch().count()); const int maxn = 4105; int n, m, k; string s[maxn]; bool ok[maxn]; int comp(string &s, string &t) { int cnt = 0; fori(i, 0, m - 1) cnt += s[i] != t[i]; return cnt; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m >> k; fori(i, 1, n) cin >> s[i]; vector<int> ord(n, 0); iota(begin(ord), end(ord), 1); vi tes = ord; shuffle(begin(ord), end(ord), rng); fill(ok, ok + n + 1, 1); for(int i: ord) { if(!ok[i]) continue; shuffle(begin(tes), end(tes), rng); for(int j: tes) { if(i == j) continue; // cout << idx << sp << idx2 << sp << i << "->" << j << endl; if(comp(s[i], s[j]) != k) { ok[i] = ok[j] = 0; } } if(ok[i]) { cout << i; 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...