Submission #140806

# Submission time Handle Problem Language Result Execution time Memory
140806 2019-08-05T09:27:10 Z Minnakhmetov Genetics (BOI18_genetics) C++14
27 / 100
2000 ms 4472 KB
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

const int N = 4100;
string s[N];
int a[N];
bool banned[N];

signed main() {
#ifdef HOME
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, m, k;
    cin >> n >> m >> k;

    mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

    for (int i = 0; i < n; i++) {
        a[i] = i;
        while (s[i].empty())
            getline(cin, s[i]);
    }

    shuffle(a, a + n, rng);

    for (int h = 0; h < n; h++) {
        int i = a[h];

        if (banned[i])
            continue;

        bool ok = true;
        for (int j = 0; j < n; j++) {
            if (i != j) {
                int d = 0;
                for (int k = 0; k < m; k++) {
                    if (s[i][k] != s[j][k])
                        d++;
                }
                if (d != k) {
                    banned[j] = 1;
                    ok = false;
                    break;
                }
            }
        }
        if (ok) {
            cout << i + 1;
            return 0;
        }
    }
    
    return 0;
}
# 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 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 5 ms 504 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 6 ms 504 KB Output is correct
12 Correct 5 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 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1823 ms 3320 KB Output is correct
2 Correct 231 ms 3960 KB Output is correct
3 Correct 1587 ms 3832 KB Output is correct
4 Correct 166 ms 1272 KB Output is correct
5 Correct 1211 ms 3960 KB Output is correct
6 Correct 680 ms 3960 KB Output is correct
7 Correct 189 ms 2296 KB Output is correct
8 Correct 196 ms 2424 KB Output is correct
9 Correct 220 ms 4344 KB Output is correct
10 Correct 1433 ms 4324 KB Output is correct
11 Correct 479 ms 3960 KB Output is correct
12 Correct 850 ms 3960 KB Output is correct
13 Correct 564 ms 3960 KB Output is correct
14 Correct 1067 ms 3576 KB Output is correct
15 Correct 1051 ms 3576 KB Output is correct
16 Correct 1049 ms 3576 KB Output is correct
17 Correct 1574 ms 4472 KB Output is correct
18 Execution timed out 2076 ms 4344 KB Time limit exceeded
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1823 ms 3320 KB Output is correct
2 Correct 231 ms 3960 KB Output is correct
3 Correct 1587 ms 3832 KB Output is correct
4 Correct 166 ms 1272 KB Output is correct
5 Correct 1211 ms 3960 KB Output is correct
6 Correct 680 ms 3960 KB Output is correct
7 Correct 189 ms 2296 KB Output is correct
8 Correct 196 ms 2424 KB Output is correct
9 Correct 220 ms 4344 KB Output is correct
10 Correct 1433 ms 4324 KB Output is correct
11 Correct 479 ms 3960 KB Output is correct
12 Correct 850 ms 3960 KB Output is correct
13 Correct 564 ms 3960 KB Output is correct
14 Correct 1067 ms 3576 KB Output is correct
15 Correct 1051 ms 3576 KB Output is correct
16 Correct 1049 ms 3576 KB Output is correct
17 Correct 1574 ms 4472 KB Output is correct
18 Execution timed out 2076 ms 4344 KB Time limit exceeded
19 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 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 5 ms 504 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 6 ms 504 KB Output is correct
12 Correct 5 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 504 KB Output is correct
18 Correct 1823 ms 3320 KB Output is correct
19 Correct 231 ms 3960 KB Output is correct
20 Correct 1587 ms 3832 KB Output is correct
21 Correct 166 ms 1272 KB Output is correct
22 Correct 1211 ms 3960 KB Output is correct
23 Correct 680 ms 3960 KB Output is correct
24 Correct 189 ms 2296 KB Output is correct
25 Correct 196 ms 2424 KB Output is correct
26 Correct 220 ms 4344 KB Output is correct
27 Correct 1433 ms 4324 KB Output is correct
28 Correct 479 ms 3960 KB Output is correct
29 Correct 850 ms 3960 KB Output is correct
30 Correct 564 ms 3960 KB Output is correct
31 Correct 1067 ms 3576 KB Output is correct
32 Correct 1051 ms 3576 KB Output is correct
33 Correct 1049 ms 3576 KB Output is correct
34 Correct 1574 ms 4472 KB Output is correct
35 Execution timed out 2076 ms 4344 KB Time limit exceeded
36 Halted 0 ms 0 KB -