Submission #518567

#TimeUsernameProblemLanguageResultExecution timeMemory
518567IerusGenetics (BOI18_genetics)C++17
74 / 100
1318 ms38288 KiB
#include<bits/stdc++.h> using namespace std; #pragma GCC optimize ("unroll-loops,Ofast,O3") #pragma GCC target("avx,avx2,fma") #define F first #define S second #define sz(x) (int)x.size() #define pb push_back #define eb emplace_back #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define NFS ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ; #define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout) typedef long long ll; const int E = 1e6+777; const long long inf = 1e18+777; const int N = 4100; const int MOD = 1e9+7; const bool I = 1; int n, m, k; string s[N]; bitset<N> bin[N]; int main(){ NFS; cin >> n >> m >> k; for(int i = 1; i <= n; ++i){ cin >> s[i]; for(int j = 0; j < m; ++j){ bin[i][j] = (s[i][j] == 'A'); } } if(n <= 100 && m <= 100){ for(int i = 1; i <= n; ++i){ bool ok = true; for(int j = 1; j <= n; ++j){ if(i == j) continue; int mx = 0; for(int p = 0; p < m; ++p){ mx += (s[i][p] != s[j][p]); } if(mx != k){ ok = false; break; } } if(ok){ cout << i << '\n'; return 0; } } } for(int i = 1; i <= n; ++i){ bool ok = true; for(int j = 1; j <= n; ++j){ if(i == j) continue; int cnt = (bin[i] ^ bin[j]).count(); // cerr << i << " " << j << " " << cnt << '\n'; if(cnt != k){ ok = false; break; } } if(ok){ cout << i; 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...