Submission #262467

#TimeUsernameProblemLanguageResultExecution timeMemory
262467sckmdGenetics (BOI18_genetics)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define MAXN 4101 int decode[678]; int a[MAXN][MAXN]; int howm[4][MAXN]; bitset <MAXN> b0[MAXN]; bitset <MAXN> b1[MAXN]; bitset <MAXN> b2[MAXN]; bitset <MAXN> b3[MAXN]; int n,m,k; vector <int> z; bool check(int idx) { z.clear(); 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++) { int a; 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); howm[a[i][j]][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) { int uk = 0; for(int j = 0; j < m; j++) { uk += (n-howm[a[x][j]][j]); } if(uk != k*(n-1))continue; if(check(x)) { cout << x+1 << "\n"; return 0; } } return 0; }

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:48:10: error: invalid types 'int[int]' for array subscript
   48 |       a[i][j]=decode[c];
      |          ^
genetics.cpp:48:22: warning: array subscript has type 'char' [-Wchar-subscripts]
   48 |       a[i][j]=decode[c];
      |                      ^
genetics.cpp:49:13: error: invalid types 'int[int]' for array subscript
   49 |       if(a[i][j]==0)b0[i].set(j);
      |             ^
genetics.cpp:50:13: error: invalid types 'int[int]' for array subscript
   50 |       if(a[i][j]==1)b1[i].set(j);
      |             ^
genetics.cpp:51:13: error: invalid types 'int[int]' for array subscript
   51 |       if(a[i][j]==2)b2[i].set(j);
      |             ^
genetics.cpp:52:13: error: invalid types 'int[int]' for array subscript
   52 |       if(a[i][j]==3)b3[i].set(j);
      |             ^
genetics.cpp:53:15: error: invalid types 'int[int]' for array subscript
   53 |       howm[a[i][j]][j]++;
      |               ^