Submission #895638

# Submission time Handle Problem Language Result Execution time Memory
895638 2023-12-30T12:30:40 Z pcc Genetics (BOI18_genetics) C++14
0 / 100
40 ms 3676 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt")

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>


const int mxn = 4140;
bitset<mxn> dp[mxn];
int N,M,K;
string in;
int arr[mxn];

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N>>M>>K;
	for(int i = 0;i<N;i++)arr[i] = i;
	srand(time(NULL));
	random_shuffle(arr,arr+N);
	for(int i = 0;i<N;i++){
		cin>>in;
		int now = arr[i];
		for(int j = 0;j<M;j++){
			if(in[j] == 'A')dp[now][j] = true;
		}
	}
	for(int i = 0;i<N;i++){
		bool flag = true;
		for(int j = 0;j<N;j++){
			if(!flag)break;
			if(i == j)continue;
			if((dp[i]^dp[j]).count() != K)flag = false;
		}
		if(flag){
			cout<<arr[i]+1;
			return 0;
		}
	}
	cout<<"impossible";
	return 0;
}

Compilation message

genetics.cpp: In function 'int main()':
genetics.cpp:39:29: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |    if((dp[i]^dp[j]).count() != K)flag = false;
      |       ~~~~~~~~~~~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 3676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 3676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -