제출 #96561

#제출 시각아이디문제언어결과실행 시간메모리
96561KastandaGenetics (BOI18_genetics)C++11
46 / 100
664 ms32504 KiB
// FAILED
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const int N = 4105;
int n, m, k;
ll R[N], H[4][N];
char A[N][N];
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++)
        {
            int ch = getchar();
            if (ch == 'A') ch = 0;
            else if (ch == 'C') ch = 1;
            else if (ch == 'G') ch = 2;
            else ch = 3;
            A[i][j] = ch;
        }
    ll tot = 0;
    for (int i = 1; i <= n; i++)
        R[i] = Rnd(), tot += R[i];
    for (int j = 1; j <= m; j++)
        for (int i = 1; i <= n; i++)
            H[A[i][j]][j] += R[i];
    for (int i = 1; i <= n; i++)
    {
        ll sum = 0;
        for (int j = 1; j <= m; j++)
            for (int h = 0; h <= 3; h ++)
                if (A[i][j] != h)
                    sum += H[h][j];
        if (sum == (tot - R[i]) * k)
            return !printf("%d\n", i);
    }
    assert(0);
}

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

genetics.cpp: In function 'int main()':
genetics.cpp:29:22: warning: array subscript has type 'char' [-Wchar-subscripts]
             H[A[i][j]][j] += R[i];
                      ^
genetics.cpp:12: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...