# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
997730 | MarwenElarbi | Genetics (BOI18_genetics) | C++17 | 2033 ms | 3256 KiB |
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 fi first
#define se second
#define ll long long
#define pb push_back
#define ii pair<int,int>
const int nax=5e4+5;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main(){
int n,m,k;
cin>>n>>m>>k;
string tab[n];
vector<int> per(n);
for (int i = 0; i < n; ++i)
{
per[i]=i;
cin>>tab[i];
}
//shuffle(per.begin(),per.end(),rng);
bool vis[n];
memset(vis,0,sizeof vis);
//int cnt=0;
for (int i = 0; i < n; ++i)
{
if(vis[i]) continue;
//if(cnt>10) break;
//cnt++;
for (int j = 0; j < n; ++j)
{
if(i==j) continue;
int cur=0;
for (int t = 0; t < m; ++t)
{
if(tab[i][t]!=tab[j][t]) cur++;
if(cur>k) break;
}
if(cur!=k){
vis[j]=1;
vis[i]=1;
}
}
}
for (int i = 0; i < n; ++i)
{
if(vis[i]==0){
cout <<i+1<<endl;
break;
}
}
}
Compilation message (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... |