Submission #305599

#TimeUsernameProblemLanguageResultExecution timeMemory
305599NaynaGenetics (BOI18_genetics)C++14
19 / 100
2078 ms16812 KiB
#include <bits/stdc++.h> using namespace std; const int mxn = 2e5+5; typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; typedef pair<int,int>pii; typedef pair<int,pii>piii; #define sf scanf #define pf printf #define input freopen("in.txt","r",stdin) #define output freopen("out.txt","w",stdout) #define inf 1e18 #define ff first #define ss second #define MP make_pair #define pb push_back #define all(v) v.begin(), v.end() #define printcase(cases) printf("Case %d:", cases); #define Unique(a) a.erase(unique(a.begin(),a.end()),a.end()) #define FAST ios_base::sync_with_stdio(0);cout.tie(0) #define endl printf("\n") #define __lcm(a, b) ((a*b)/__gcd(a, b)) map<string,int>mark; int vis[mxn]; int in[mxn]; int dir[mxn]; int main() { // input; // output; 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 = 0; for(int r = 0; r < n; r++) { if(i==r) continue; bitset<4105>tmp = v[i]^v[r]; int x = tmp.count(); if(x==k) cnt++; else 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...