제출 #473710

#제출 시각아이디문제언어결과실행 시간메모리
473710Sarah_MokhtarGenetics (BOI18_genetics)C++14
27 / 100
61 ms5348 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define read freopen("acpc.in","r",stdin); #define LESSGO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); const ll N=1200,M=505,OO=1e16,mod=1e9+9; int n,m,d,onB[N],offB[N],dis[N]; string a[N]; int solve(){ for(int i=0;i<n;++i){ int cnt=0; for(int j=0;j<n;++j){ if(i==j) continue; int diff=0; for(int k=0;k<m;++k){ if(a[i][k]!=a[j][k]) ++diff; } if(diff==d) ++cnt; } if(cnt==n-1) return i+1; } return 0; } int main(){ cin>>n>>m>>d; for(int i=0;i<n;++i) cin>>a[i]; if(n<=100){ cout<<solve()<<"\n"; return 0; } bitset<N>s[N]; for(int i=0;i<n;++i){ for(int j=0;j<m;++j){ if(a[i][j]=='A') s[i][j]=1; } } for(int i=0;i<n;++i){ int cnt=0; for(int j=0;j<n;++j){ if(i==j) continue; bitset<N>tmp=(s[i]^s[j]); if(tmp.count()==d) ++cnt; } if(cnt==n-1){ cout<<i+1<<"\n"; return 0; } } }

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

genetics.cpp: In function 'int main()':
genetics.cpp:43:27: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |             if(tmp.count()==d) ++cnt;
      |                ~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...