Submission #321331

#TimeUsernameProblemLanguageResultExecution timeMemory
321331NaynaGenetics (BOI18_genetics)C++14
0 / 100
14 ms1760 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 = i; 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 = 0; if(vis[i]) continue; for(int r = i+1; 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-i-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...