제출 #262468

#제출 시각아이디문제언어결과실행 시간메모리
262468sckmdGenetics (BOI18_genetics)C++14
100 / 100
1552 ms91232 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; }

컴파일 시 표준 에러 (stderr) 메시지

genetics.cpp: In function 'int main()':
genetics.cpp:48:22: warning: array subscript has type 'char' [-Wchar-subscripts]
   48 |       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...