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>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb push_back
#define f first
#define s second
#define pi 3.141592653589793238
using namespace std;
ll gcd( ll a, ll b )
{
if(b==0)
{
return a;
}
else
{
return gcd( b, a%b );
}
}
ll lcm (ll a, ll b)
{
return (a*b)/gcd(a,b);
}
ll power(ll a, ll b) //a is base, b is exponent
{
if(b==0)
return 1;
if(b==1)
return a;
if(b%2 == 1)
return (power(a,b-1)*a)%mod;
ll q = power(a,b/2);
return (q*q)%mod;
}
string a[4105];
int main()
{
std::ios::sync_with_stdio(false);
int n,m,k;
cin >> n >> m >> k;
for(int i = 1;i<=n;i++){
cin >> a[i];
}
for(int i =1;i<=n;i++){
string s = a[i];
bool ok = true;
for(int j = 1;j<=n;j++){
if(j == i) continue;
string t = a[j];
int cnt = 0;
for(int k =0;k<t.size();k++){
if(t[k] != s[k]){
cnt++;
}
}
if(cnt != k){
ok = false;
break;
}
}
if(ok){
cout<<i<<endl;
return 0;
}
}
return 0;
}
//Hello, this is a snippet.
Compilation message (stderr)
genetics.cpp: In function 'int main()':
genetics.cpp:68:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
68 | for(int k =0;k<t.size();k++){
| ~^~~~~~~~~
# | 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... |