Submission #979900

#TimeUsernameProblemLanguageResultExecution timeMemory
979900vjudge1Genetics (BOI18_genetics)C++17
19 / 100
2009 ms11296 KiB
#include <bits/stdc++.h>
using namespace std;

const int maxN  = 4'101;

int N, M, K;
bitset<maxN> A[maxN];

int main() {
    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);
            if (buf == 'A') A[i][j] = 1;
        }
    }

    for (int r = 1; r <= N; r++) {
        bool valid = true;
        for (int i = 1; i <= N; i++) if (i != r) {
            if ((A[r] ^ A[i]).count() != K) {
                valid = false;
                break;
            }
        }

        if (valid) {
            printf("%d\n", r);
            exit(0);
        }
    }
}

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:22:39: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |             if ((A[r] ^ A[i]).count() != K) {
      |                 ~~~~~~~~~~~~~~~~~~~~~~^~~~
genetics.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d %d %d", &N, &M, &K);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
genetics.cpp:14:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |             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...