Submission #151154

#TimeUsernameProblemLanguageResultExecution timeMemory
151154BlagojceGenetics (BOI18_genetics)C++11
19 / 100
2023 ms69496 KiB
#include <bits/stdc++.h> #define fr(i, n, m) for(int i = (n); i < (m); i ++) #define pb push_back #define st first #define nd second #define pq priority_queue #define all(x) begin(x),end(x) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; ll const inf = 1e9; ll const mod = 1e9 + 7; ld const eps = 1e-9; bitset<4101> a[4101]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m, k; cin >> n >> m >> k; fr(i, 0, n){ string s; cin >> s; fr(j, 0, m){ if(s[j] == 'A') a[i][j] = 1; } } bitset<4101> op; int cnt[n][n]; memset(cnt, -1, sizeof(cnt)); fr(i, 0, n){ bool ok = true; fr(j, 0, n){ if(i == j) continue; if(cnt[i][j] == -1){ op = a[i]^a[j]; cnt[i][j] = cnt[j][i] = op.count(); } if(cnt[i][j] != k){ ok = false; break; } } if(ok){ cout << i + 1<< endl; return 0; } } cout << -1 << endl; 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...