Submission #96542

# Submission time Handle Problem Language Result Execution time Memory
96542 2019-02-10T08:49:40 Z Kastanda Genetics (BOI18_genetics) C++11
27 / 100
2000 ms 4088 KB
#include<bits/stdc++.h>
using namespace std;
const int N = 4105;
int n, m, k, P[N];
char A[N];
bitset < N > B[N][4];
inline int Diff(int i, int j)
{
    int diff = m;
    for (int w = 0; w <= 3; w ++)
        diff -= (B[i][w] & B[j][w]).count();
    return (diff);
}
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();
            A[j] = ch;
            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;
        }
    }
    srand(time(0));
    iota(P, P + n + 1, 0);
  	random_shuffle(P + 1, P + n + 1);
    for (int i = 1; i <= n; i++)
    {
        int j = 1;
        for (; j <= n; j++)
            if (i != P[j] && Diff(i, P[j]) != k)
                break;
        if (j > n)
            return !printf("%d\n", i);
    }
    assert(0);
}

Compilation message

genetics.cpp: In function 'int main()':
genetics.cpp:16: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 time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 6 ms 504 KB Output is correct
5 Correct 9 ms 504 KB Output is correct
6 Correct 10 ms 508 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 6 ms 504 KB Output is correct
10 Correct 7 ms 504 KB Output is correct
11 Correct 9 ms 504 KB Output is correct
12 Correct 14 ms 504 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
14 Correct 5 ms 504 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 5 ms 504 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1554 ms 3576 KB Output is correct
2 Correct 1469 ms 4088 KB Output is correct
3 Execution timed out 2033 ms 3960 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1554 ms 3576 KB Output is correct
2 Correct 1469 ms 4088 KB Output is correct
3 Execution timed out 2033 ms 3960 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 6 ms 504 KB Output is correct
5 Correct 9 ms 504 KB Output is correct
6 Correct 10 ms 508 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 6 ms 504 KB Output is correct
10 Correct 7 ms 504 KB Output is correct
11 Correct 9 ms 504 KB Output is correct
12 Correct 14 ms 504 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
14 Correct 5 ms 504 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 5 ms 504 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 1554 ms 3576 KB Output is correct
19 Correct 1469 ms 4088 KB Output is correct
20 Execution timed out 2033 ms 3960 KB Time limit exceeded
21 Halted 0 ms 0 KB -