제출 #1257670

#제출 시각아이디문제언어결과실행 시간메모리
1257670chikien2009Genetics (BOI18_genetics)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

void setup()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int n, m, k, id[5000], a, b, c;
long long sum[5000][4], all, temp;
mt19937 random(time(0));
string s[5000], t = "ATGC";

int main()
{
    setup();

    cin >> n >> m >> k;
    for (int i = 0; i < n; ++i)
    {
        cin >> s[i];
        id[i] = random() % ((int)1e9 + 7);
        all += id[i];
        for (int j = 0; j < m; ++j)
        {
            for (int c = 0; c < 4; ++c)
            {
                sum[j][c] += (s[i][j] != t[c]) * id[i];
            }
        }
    }
    for (int i = 0; i < n; ++i)
    {
        temp = 0;
        for (int j = 0; j < m; ++j)
        {
            for (int c = 0; c < 4; ++c)
            {
                temp += sum[j][c] * (s[i][j] == t[c]);
            }
        }
        if (temp == (all - id[i]) * k)
        {
            cout << i + 1;
            return 0;
        }
    }
    return 0;
}

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

genetics.cpp:14:16: error: 'std::mt19937 random' redeclared as different kind of entity
   14 | mt19937 random(time(0));
      |                ^~~~
In file included from /usr/include/c++/11/bits/std_abs.h:38,
                 from /usr/include/c++/11/cmath:47,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from genetics.cpp:1:
/usr/include/stdlib.h:402:17: note: previous declaration 'long int random()'
  402 | extern long int random (void) __THROW;
      |                 ^~~~~~