제출 #213441

#제출 시각아이디문제언어결과실행 시간메모리
213441MKopchevGenetics (BOI18_genetics)C++14
100 / 100
1423 ms54396 KiB
#include<bits/stdc++.h> using namespace std; const int nmax=4100+42,SZ=16,LIM=1<<SZ; int n,m,k; char inp[nmax][nmax]; char in() { char c=getchar(); while(c!='A'&&c!='C'&&c!='G'&&c!='T')c=getchar(); return c; } int seen[4][nmax]; int hsh(char c) { if(c=='A')return 0; if(c=='C')return 1; if(c=='G')return 2; return 3; } unsigned int hsh_values[nmax][nmax]; int bits_in[LIM]; int ask(unsigned int val) { return bits_in[val/LIM]+bits_in[val%LIM]; } void test(int bad) { for(int i=1;i<=n;i++) if(i!=bad) { int diff=0; for(int j=0;j<=m/SZ;j++) diff=diff+ask(hsh_values[i][j]^hsh_values[bad][j]); if(diff!=k)return; } printf("%i\n",bad); exit(0); } int main() { scanf("%i%i%i",&n,&m,&k); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) inp[i][j]=in(); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { seen[hsh(inp[i][j])][j]++; hsh_values[i][j/SZ]=hsh_values[i][j/SZ]*4+hsh(inp[i][j]); } for(int i=0;i<LIM;i++) { int i_=i; while(i_) { bits_in[i]+=(i_%4!=0); i_=i_/4; } } for(int i=1;i<=n;i++) { int total_diff=0; for(int j=1;j<=m;j++) total_diff+=seen[0][j]+seen[1][j]+seen[2][j]+seen[3][j]-seen[hsh(inp[i][j])][j]; if(total_diff==k*(n-1))test(i); } return 0; }

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

genetics.cpp: In function 'int main()':
genetics.cpp:46:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i%i%i",&n,&m,&k);
     ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...