이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/**
* author: wxhtzdy
* created: 10.11.2022 15:59:08
**/
#include <bits/stdc++.h>
using namespace std;
string c = "ACGT";
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m, k;
cin >> n >> m >> k;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
}
map<string, int> mp;
vector<int> ids;
vector<string> new_s;
for (int i = 0; i < n; i++) {
mp[s[i]] += 1;
if (mp[s[i]] == 1) {
new_s.push_back(s[i]);
ids.push_back(i);
}
}
swap(s, new_s);
n = (int) s.size();
const int N = 4100;
vector<vector<bitset<N>>> f(4, vector<bitset<N>>(n));
for (int i = 0; i < 4; i++) {
for (int j = 0; j < n; j++) {
for (int k = 0; k < m; k++) {
f[i][j][k] = (c[i] == s[j][k] ? 1 : 0);
}
}
}
vector<vector<int>> d(n, vector<int>(n));
vector<bool> is(n, true);
for (int i = 0; i < n; i++) {
if (mp[s[i]] > 1) {
is[i] = false;
}
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (!is[i] && !is[j]) {
continue;
}
for (int p = 0; p < 4; p++) {
d[i][j] += (f[p][i] ^ f[p][j]).count();
if (d[i][j] > k * 2) {
is[i] = false;
is[j] = false;
}
}
if (d[i][j] != k * 2) {
is[i] = false;
is[j] = false;
}
}
if (is[i]) {
cout << ids[i] + 1 << '\n';
return 0;
}
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (d[i][j] != k * 2) {
is[i] = false;
is[j] = false;
}
}
}
for (int i = 0; i < n; i++) {
if (is[i]) {
cout << ids[i] + 1 << '\n';
}
}
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... |