Submission #952959

#TimeUsernameProblemLanguageResultExecution timeMemory
952959koukirocksGenetics (BOI18_genetics)C++17
46 / 100
2029 ms22908 KiB
#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
 
namespace{using namespace std;}
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const ll MAX=4200+10,P=1e9+7;
const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f;
 
int n,m,k;
bitset<MAX> gne[MAX][4];
 
int main() {
	speed;
	cin>>n>>m>>k;
	for (int i=1;i<=n;i++) {
		for (int j=0;j<m;j++) {
			char c;
			cin>>c;
			gne[i][0][j]=(c=='A');
			gne[i][1][j]=(c=='T');
			gne[i][2][j]=(c=='C');
			gne[i][3][j]=(c=='G');
		}
	}
	int ans=-1;
	for (int i=1;i<=n;i++) {
		bool flag=true;
		for (int j=1;j<=n;j++) {
			if (i==j) continue;
			if ((gne[i][0]^gne[j][0]).count()+(gne[i][1]^gne[j][1]).count()+(gne[i][2]^gne[j][2]).count()+(gne[i][3]^gne[j][3]).count()!=2*k) {
				flag=false;
				break;
			}
		}
		if (flag) {
			ans=i;
			break;
		}
	}
	cout<<ans<<"\n";
	return 0;
}

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:40:127: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |    if ((gne[i][0]^gne[j][0]).count()+(gne[i][1]^gne[j][1]).count()+(gne[i][2]^gne[j][2]).count()+(gne[i][3]^gne[j][3]).count()!=2*k) {
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...