Submission #96541

#TimeUsernameProblemLanguageResultExecution timeMemory
96541KastandaGenetics (BOI18_genetics)C++11
46 / 100
2056 ms11844 KiB
#include<bits/stdc++.h> using namespace std; const int N = 4105; int n, m, k, P[N]; char A[N]; bitset < N > B[N][4]; inline int Diff(int i, int j) { int diff = m; for (int w = 0; w <= 3; w ++) diff -= (B[i][w] & B[j][w]).count(); return (diff); } int main() { scanf("%d%d%d", &n, &m, &k); getchar(); for (int i = 1; i <= n; i++, getchar()) { for (int j = 1; j <= m; j++) { int ch = getchar(); A[j] = ch; if (ch == 'A') ch = 0; else if (ch == 'C') ch = 1; else if (ch == 'G') ch = 2; else ch = 3; B[i][ch][j] = 1; } } srand(time(0)); iota(P, P + n + 1, 0); for (int i = 1; i <= n; i++) { random_shuffle(P + 1, P + n + 1); int j = 1; for (; j <= n; j++) if (i != P[j] && Diff(i, P[j]) != k) break; if (j > n) return !printf("%d\n", i); } assert(0); }

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &m, &k);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...