제출 #473681

#제출 시각아이디문제언어결과실행 시간메모리
473681ZaZo_Genetics (BOI18_genetics)C++14
19 / 100
2081 ms2276 KiB
// G - Even Odd #include <bits/stdc++.h> #define ZAZO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define int unsigned long long using namespace std; // i have maximum 65 chuncks , each chuck will have 64 bits (elements) unsigned long long bits[4100][65]; int n , m , k ; bool check(int x , int y) { int cnt=0; for(int i = 0 ; i < 65 ; i++) cnt += __builtin_popcountll(bits[x][i]^bits[y][i]); if(cnt == k) return true; return false; } int32_t main() { ZAZO cin >> n >> m >> k; for(int i = 0 ; i < n ; i++) { for(int j = 0 ; j < m ; j ++) { char s; cin >> s; // get the bit you want by checking mod int pos = ((unsigned long long) 1<<j%64); // set the bit to one in the specific place in the specific chunk; if(s == 'C') bits[i][j/64] |= pos; } } map<int,int>ans; for(int i = 0 ; i < n ; i ++) { for(int j = i+1 ; j < n ; j ++) { bool ok = check(i , j); if(ok) { ans[i]++; ans[j]++; if(ans[i] == n-1) { cout<<i+1; return 0; } if(ans[j] == n-1){ cout<<j+1; return 0; } } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...