Submission #501275

#TimeUsernameProblemLanguageResultExecution timeMemory
501275RGBBGenetics (BOI18_genetics)C++14
46 / 100
2076 ms39900 KiB
#include <iostream> #include <bits/stdc++.h> #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") using namespace std; const int MAX=4100; int n,m,k; bool flag[MAX],check[MAX][MAX]; bitset<MAX>col[MAX][4]; bitset<MAX>temp; int cnt; vector<int>ind; string inp[MAX]; mt19937 rd(chrono::steady_clock::now().time_since_epoch().count()); int get_random_int(int a){ return uniform_int_distribution<int>(0,a-1)(rd); } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin>>n>>m>>k; k*=2; ind=vector<int>(n); for(int i=0;i<n;i++){ cin>>inp[i]; ind[i]=i; } random_shuffle(ind.begin(),ind.end(),get_random_int); 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; else if(inp[ind[i]][j]=='C')col[i][1][j]=1; else if(inp[ind[i]][j]=='G')col[i][2][j]=1; else col[i][3][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; cnt=0; cnt+=(col[i][0]^col[j][0]).count(); cnt+=(col[i][1]^col[j][1]).count(); cnt+=(col[i][2]^col[j][2]).count(); cnt+=(col[i][3]^col[j][3]).count(); if(cnt!=k){ villain=false; flag[j]=true; break; } } if(villain){ cout<<ind[i]+1<<"\n"; return 0; } } }

Compilation message (stderr)

genetics.cpp:4: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    4 | #pragma GCC optimization ("O3")
      | 
genetics.cpp:5: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    5 | #pragma GCC optimization ("unroll-loops")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...