제출 #895718

#제출 시각아이디문제언어결과실행 시간메모리
895718pccGenetics (BOI18_genetics)C++14
46 / 100
2060 ms39860 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,popcnt") #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second #define tlll tuple<ll,ll,ll> #define int short const int mxn = 4100; bitset<mxn> dp[5][mxn]; int N,M,K; bitset<mxn> no; int perm[mxn],pos[mxn]; int check[mxn][mxn]; main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>N>>M>>K; for(int i = 0;i<N;i++)perm[i] = i; srand(time(NULL)); random_shuffle(perm,perm+N); for(int i = 0;i<N;i++)pos[perm[i]] = i; for(int i = 0;i<N;i++){ string s; cin>>s; int now = pos[i]; for(int j = 0;j<M;j++){ if(s[j] == 'A')dp[0][now][j] = 1; else if(s[j] == 'T')dp[1][now][j] = 1; else if(s[j] == 'G')dp[2][now][j] = 1; else dp[3][now][j] = 1; } } /* for(int i = 0;i<N;i++){ cout<<i<<":"<<endl; for(int j = 0;j<4;j++){ for(int k = 0;k<M;k++)cout<<dp[i][j][k]; cout<<endl; } cout<<endl; } */ for(int i =0;i<N;i++){ if(no[i])continue; bool flag = true; for(int j = 0;j<N;j++){ if(i == j||check[i][j])continue; if(((dp[0][i]^dp[0][j])|(dp[1][i]^(dp[1][j]))|(dp[2][i]^dp[2][j])|(dp[3][i]^dp[3][j])).count() != K){ flag = false; no[i] = no[j] = true; break; } else check[i][j] = check[j][i] = true; } if(flag){ cout<<perm[i]+1; return 0; } } assert(false); }

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

genetics.cpp:23:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   23 | main(){
      | ^~~~
genetics.cpp: In function 'int main()':
genetics.cpp:57:99: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'short int' [-Wsign-compare]
   57 |    if(((dp[0][i]^dp[0][j])|(dp[1][i]^(dp[1][j]))|(dp[2][i]^dp[2][j])|(dp[3][i]^dp[3][j])).count() != 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...