| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 104584 | daili | Genetics (BOI18_genetics) | C++14 | 2085 ms | 4676 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int diff(string a, string b)
{
int cnt = 0;
for (int i = 0; i < a.size() ; i++)
{
if (a[i] != b[i])
{
cnt++;
}
}
return cnt;
}
void Task1(int n, int m ,int k)
{
vector<string> all;
for (int i =0; i <n ; i++)
{
string x;
cin >> x;
all.push_back(x);
}
for (int i = 0; i < n; i++)
{
bool flag = true;
for (int j = 0; j < n; j++)
{
if (i == j)
{
continue;
}
if (diff(all[i], all[j]) != k)
{
flag = false;
break;
}
}
if (flag)
{
cout << i+1 << "\n";
return;
}
}
}
void TaskBC(int n, const int m, int k)
{
vector<bitset<4101> > all;
for (int i = 0; i < n; i++)
{
bitset<4101> bit;
string x;
cin >> x;
for (int j = 0; j < m; j++)
{
if (x[j] == 'A')
{
bit[j] = 1;
}
}
all.push_back(bit);
}
for (int i = 0; i < n; i++)
{
bool flag = true;
for (int j = 0; j < n; j++)
{
if (i == j)
{
continue;
}
bitset<4101> xr = all[i] ^ all[j];
if (xr.count() != k)
{
flag = false;
break;
}
}
if (flag)
{
cout << i+1 << "\n";
return;
}
}
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m, k;
cin >> n >> m >> k;
if (n <= 100 && m <= 100)
{
Task1(n, m, k);
}
else
{
TaskBC(n, m, k);
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
