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;
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("popcnt")
typedef long long ll;
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) int(x.size())
const int N = 4100;
int n, m, k, id[30], c[N][N], lim = 4;
bitset<N> b[N][4];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m >> k;
id[int('A'-'A')] = 0;
id[int('G'-'A')] = 2;
id[int('T'-'A')] = 3;
id[int('C'-'A')] = 1;
if (max(n, m) > 1800) {
lim = 2;
}
for (int i = 0; i < n; i++) {
string s;
cin >> s;
for (int j = 0; j < m; j++) {
b[i][id[int(s[j]-'A')]][j] = true;
}
for (int j = i-1; j >= 0; j--) {
for (int kk = 0; kk < lim; kk++) {
c[i][j] += (b[i][kk] & b[j][kk]).count();
}
c[j][i] = c[i][j];
}
}
for (int i = 0; i < n; i++) {
bool f = true;
for (int j = 0; j < n && f; j++) {
if (j == i)continue;
f &= (c[i][j] == m-k);
}
if (f) {
cout << i+1;
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... |