제출 #421042

#제출 시각아이디문제언어결과실행 시간메모리
421042nicolaalexandraGenetics (BOI18_genetics)C++14
27 / 100
2075 ms31716 KiB
#include <bits/stdc++.h> #define DIM 4200 using namespace std; char a[DIM][DIM],ch[5]; int cnt[DIM][DIM]; bitset <DIM> v[DIM]; int n,m,k,i,j; int main (){ //ifstream cin ("date.in"); //ofstream cout ("date.out"); cin>>n>>m>>k; for (i=1;i<=n;i++) cin>>a[i]+1; ch[1] = 'A', ch[2] = 'C', ch[3] = 'G', ch[4] = 'T'; for (int pas=1;pas<=4;pas++){ for (i=1;i<=n;i++){ v[i].reset(); for (j=1;j<=m;j++){ if (a[i][j] == ch[pas]) v[i][j] = 1; }} for (i=1;i<=n;i++) for (j=i+1;j<=n;j++){ int val = (v[i] & v[j]).count(); //int val = __builtin_popcount (v[i] & v[j]); cnt[i][j] += val; cnt[j][i] += val; } } for (i=1;i<=n;i++){ int ok = 1; for (j=1;j<=n;j++) if (i != j && cnt[i][j] != m - k){ ok = 0; break; } if (ok){ cout<<i; break; } } return 0; }

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

genetics.cpp: In function 'int main()':
genetics.cpp:17:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   17 |         cin>>a[i]+1;
      |              ~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...