Submission #1184216

#TimeUsernameProblemLanguageResultExecution timeMemory
1184216lopkusGenetics (BOI18_genetics)C++20
46 / 100
938 ms58072 KiB
#include <bits/stdc++.h> using i64 = long long; using u64 = unsigned long long; using u32 = unsigned; using u128 = unsigned __int128; const int M = 1801; std::bitset<M> B[M][4]; void solve() { int n, m, k; std::cin >> n >> m >> k; std::vector<std::vector<int>> a(n, std::vector<int>(m)); for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { char x; std::cin >> x; if(x == 'A') { a[i][j] = 0; } if(x == 'C') { a[i][j] = 1; } if(x == 'G') { a[i][j] = 2; } if(x == 'T') { a[i][j] = 3; } } } /** for(int i = 1; i <= n; i++) { int is = 1; for(int ath = 1; ath <= n; ath++) { if(i == ath) { continue; } int diff = 0; for(int x = 1; x <= m; x++) { diff += (a[i][x] != a[ath][x]); } is &= (diff == k); } if(is) { std::cout << i; return; } }**/ for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { B[i][a[i][j]].set(j); } } std::vector<std::vector<int>> cnt(n + 1, std::vector<int>(4)); for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { cnt[i][a[i][j]] += 1; } } for(int i = 0; i < n; i++) { int can = 1; for(int ath = 0; ath < n; ath++) { if(i == ath) { continue; } int diff = 0; for(int x = 0; x < 4; x++) { diff += cnt[i][x] - (B[i][x] & B[ath][x]).count(); } can &= (diff == k); if(!can) { break; } } if(can) { std::cout << i + 1; return; } } } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int t = 1; //std::cin >> t; while (t--) { solve(); } 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...