Submission #979899

#TimeUsernameProblemLanguageResultExecution timeMemory
979899vjudge1Genetics (BOI18_genetics)C++17
27 / 100
7 ms600 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int maxN = 123; char id[256]; int N, M, K; int A[maxN][maxN]; int main() { id['A'] = 0; id['C'] = 1; id['G'] = 2; id['T'] = 3; scanf("%d %d %d", &N, &M, &K); char buf; for (int i = 1; i <= N; i++) { for (int j = 1; j <= M; j++) { scanf(" %c", &buf); A[i][j] = id[buf]; } } for (int r = 1; r <= N; r++) { bool valid = true; for (int i = 1; i <= N; i++) if (i != r) { int diff = 0; for (int c = 1; c <= M; c++) { if (A[r][c] != A[i][c]) diff++; } if (diff != K) { valid = false; break; } } if (valid) { printf("%d\n", r); exit(0); } } }

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:21:26: warning: array subscript has type 'char' [-Wchar-subscripts]
   21 |             A[i][j] = id[buf];
      |                          ^~~
genetics.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("%d %d %d", &N, &M, &K);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
genetics.cpp:20:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |             scanf(" %c", &buf);
      |             ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...