Submission #321335

#TimeUsernameProblemLanguageResultExecution timeMemory
321335NaynaGenetics (BOI18_genetics)C++17
0 / 100
256 ms1504 KiB
#include <bits/stdc++.h> using namespace std; const int mxn = 3e5+5; #define FAST ios_base::sync_with_stdio(0);cout.tie(0) typedef long long ll; bool vis[4105]; int main() { // input; // output; FAST; int n, m, k; cin >> n >> m >> k; vector<bitset<4105> >v; for(int i = 0; i < n; i++) { string s; cin >> s; bitset<4105>tmp; // cout << tmp << '\n'; for(int r = 0; r < m; r++) { if(s[r]=='A') tmp[r] = '1'; } v.push_back(tmp); } int ans = -1; for(int i = 0; i < n; i++) { int cnt = i; if(vis[i]) continue; for(int r = i; r < n; r++) { if(i==r) continue; bitset<4105>tmp = v[i]^v[r]; int x = tmp.count(); if(x==k) cnt++; else { vis[r] = 1; break; } } if(cnt==n-1) { ans = i+1; break; } } cout << ans << '\n'; 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...