Submission #262461

#TimeUsernameProblemLanguageResultExecution timeMemory
262461sckmdGenetics (BOI18_genetics)C++14
46 / 100
1775 ms25344 KiB
#include <bits/stdc++.h> using namespace std; #define MAXN 4001 int decode[678]; int a[MAXN][MAXN]; bitset <MAXN> b0[MAXN]; bitset <MAXN> b1[MAXN]; bitset <MAXN> b2[MAXN]; bitset <MAXN> b3[MAXN]; int n,m,k; bool check(int idx) { vector <int> z; for(int j = 0; j < n; j++)z.push_back(j); random_shuffle(z.begin(),z.end()); for(auto id:z) { if(id==idx)continue; int r = 0; r += (b0[idx]^b0[id]).count(); r += (b1[idx]^b1[id]).count(); r += (b2[idx]^b2[id]).count(); r += (b3[idx]^b3[id]).count(); if(r != 2*k)return false; } return true; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); decode['A']=0;decode['C']=1;decode['T']=2;decode['G']=3; cin >> n >> m >> k; for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { char c; cin >> c; a[i][j]=decode[c]; if(a[i][j]==0)b0[i].set(j); if(a[i][j]==1)b1[i].set(j); if(a[i][j]==2)b2[i].set(j); if(a[i][j]==3)b3[i].set(j); } } vector <int> vec; for(int i = 0; i < n; i++)vec.push_back(i); random_shuffle(vec.begin(),vec.end()); for(auto x:vec) { if(check(x)) { cout << x+1 << "\n"; return 0; } } return 0; }

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:44:22: warning: array subscript has type 'char' [-Wchar-subscripts]
   44 |       a[i][j]=decode[c];
      |                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...