Submission #501284

#TimeUsernameProblemLanguageResultExecution timeMemory
501284RGBBGenetics (BOI18_genetics)C++14
100 / 100
1304 ms56708 KiB
#include <iostream> #include <bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") using namespace std; const int MAX=4100; int n,m,k; bool flag[MAX],check[MAX][MAX]; bitset<MAX>col[MAX][2]; bitset<MAX>temp; int cnt; vector<int>ind; string inp[MAX]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin>>n>>m>>k; ind=vector<int>(n); for(int i=0;i<n;i++){ cin>>inp[i]; ind[i]=i; } random_shuffle(ind.begin(),ind.end()); for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(inp[ind[i]][j]=='A'){ col[i][0][j]=1; col[i][1][j]=1; } else if(inp[ind[i]][j]=='G')col[i][0][j]=1; else if(inp[ind[i]][j]=='T')col[i][1][j]=1; } } for(int i=0;i<n;i++){ if(flag[i])continue; bool villain=true; for(int j=0;j<n;j++){ if(j==i)continue; if(check[i][j])continue; check[j][i]=true; if(((col[i][0]^col[j][0])|(col[i][1]^col[j][1])).count()!=k){ villain=false; flag[j]=true; break; } } if(villain){ cout<<ind[i]+1<<"\n"; return 0; } } }

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:47:69: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |             if(((col[i][0]^col[j][0])|(col[i][1]^col[j][1])).count()!=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...