This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,e) for (int i = s; i <= e; ++i)
#define rrep(i,s,e) for (int i = s; i >= e; --i)
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
srand(7);
int n, m, k; cin >> n >> m >> k;
bitset<4100> x[n][4];
unordered_map<char, int> mp;
mp['A'] = 0;
mp['C'] = 1;
mp['G'] = 2;
mp['T'] = 3;
rep (i,0,n-1) {
string s; cin >> s;
rep (j,0,(int)s.size()-1) x[i][mp[s[j]]] |= bitset<4100>(1)<<j;
}
vi order(n);
iota(all(order), 0);
random_shuffle(all(order));
int s[n] = {};
rep (iii,0,n-1) {
int i = order[iii];
if (s[i]) continue;
bool suc = 1;
rep (ij,0,n-1) {
int j = order[ij];
if (i==j) continue;
int cnt = 0;
rep (l,0,3) cnt += (x[i][l]^x[j][l]).count();
if (cnt/2!=k) {
s[j] = 1;
suc = 0;
}
}
if (suc) {
cout << i+1 << "\n";
break;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |