제출 #96551

#제출 시각아이디문제언어결과실행 시간메모리
96551KastandaGenetics (BOI18_genetics)C++11
19 / 100
2059 ms7416 KiB
#include<bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
using namespace std;
const int N = 4105;
int n, m, k, P[N], Q[N];
bitset < N > B[N];
inline int Diff(int i, int j)
{
    return ((B[i] ^ B[j]).count());
    /*int diff = m;
    for (int w = 0; w <= 3; w ++)
        diff -= (B[i][w] & B[j][w]).count();
    return (diff);*/
}
mt19937 Rnd(chrono::steady_clock::now().time_since_epoch().count());
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++)
        {
            B[i][j] = (getchar() == 'A');
            /*int ch = getchar();
            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;*/
        }
    }
    iota(P, P + n + 1, 0);
    iota(Q, Q + n + 1, 0);
    shuffle(Q + 1, Q + n + 1, Rnd);
    for (int i = 1; i <= n; i++)
    {
        int &id = Q[i];
        if (i % 20 == 0)
            shuffle(P + 1, P + n + 1, Rnd);
        int j = 1;
        for (; j <= n; j++)
            if (id != P[j] && Diff(id, P[j]) != k)
                break;
        if (j > n)
            return !printf("%d\n", id);
    }
    assert(0);
}

컴파일 시 표준 에러 (stderr) 메시지

genetics.cpp: In function 'int main()':
genetics.cpp:19: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...