Submission #441496

#TimeUsernameProblemLanguageResultExecution timeMemory
441496Haruto810198Genetics (BOI18_genetics)C++17
27 / 100
2085 ms36408 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define FOR(i, l, r, d) for(int i=(l); i<=(r); i+=(d)) #define szof(x) ((int)(x).size()) #define vi vector<int> #define pii pair<int,int> #define F first #define S second #define pb push_back #define eb emplace_back #define mkp make_pair const int INF = 2147483647; const int LNF = INF*INF; const int MOD = 1000000007; const int mod = 998244353; //#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") const int MAX = 4110; int n, m, k; string str[MAX]; int dif[MAX][MAX]; int per1[MAX], per2[MAX]; int res; void find_dif(int u, int v){ int cnt = 0; FOR(i, 0, m-1, 1){ if(str[u][i] != str[v][i]){ cnt++; } } dif[u][v] = dif[v][u] = cnt; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n>>m>>k; FOR(i, 1, n, 1){ cin>>str[i]; } FOR(i, 1, n, 1){ per1[i] = per2[i] = i; } random_shuffle(per1+1, per1+n+1); random_shuffle(per2+1, per2+n+1); FOR(c, 1, n, 1){ int i = per1[c]; bool flag = 1; FOR(d, 1, n, 1){ int j = per2[d]; find_dif(i, j); if(j!=i and dif[i][j]!=k){ flag = 0; break; } } if(flag){ res = i; } } cout<<res<<'\n'; 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...