Submission #415620

#TimeUsernameProblemLanguageResultExecution timeMemory
415620BlagojceGenetics (BOI18_genetics)C++11
19 / 100
2060 ms18928 KiB
#include <bits/stdc++.h> #define fr(i, n, m) for(int i = (n); i < (m); i ++) #define pb push_back #define st first #define nd second #define pq priority_queue #define all(x) begin(x), end(x) using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll,ll> pii; const ll inf = 1e18; const int i_inf = 1e9; const ll mod = 1e9+7; mt19937 _rand(time(NULL)); const int mxn = 2e5; int n, m, k; bitset<4100> bit[4100]; vector<int> v; void solve(){ cin >> n >> m >> k; fr(i, 0, n){ string s; cin >> s; fr(j, 0, m){ if(s[j] == 'A') bit[i][j] = 1; } } fr(i, 0, n) v.pb(i); shuffle(all(v), _rand); for(auto a : v){ bool ok = true; for(auto b : v){ if(a == b) continue; int d = (bit[a]^bit[b]).count(); if(d != k){ ok = false; break; } } if(ok){ cout<<a+1<<endl; return; } } cout<<-1<<endl; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...