Submission #153136

# Submission time Handle Problem Language Result Execution time Memory
153136 2019-09-12T15:10:21 Z Swan Genetics (BOI18_genetics) C++14
46 / 100
2000 ms 15096 KB
#include <bits/stdc++.h>
#define stop system("pause")
#define INP freopen("input.txt","r",stdin)
#define OUTP freopen("solve1.txt","w",stdout)
#define int long long
using namespace std;

typedef long long ll;

const int maxn = 4111;

int cnt[maxn][5];
int n,m,k;

bool cmp(string& a,string& b){
    int res = 0;
    for(int i(0); i < a.size();i++){
        if(a[i]!=b[i])res++;
    }
    return res == k;
}

int get_num(char c){
    if(c == 'A')return 0;
    if(c == 'C')return 1;
    if(c == 'T')return 2;
    return 3;
}

main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> k;
    int need = (n-1)*k;
    vector<string> v;
    vector<char> c;
    c.push_back('A');
    c.push_back('C');
    c.push_back('T');
    c.push_back('G');
    for(int i(0); i < n;i++){
        string s; cin >> s;
        v.push_back(s);
        for(int j(0); j < s.size();j++){
            cnt[j][get_num(s[j])]++;
        }
    }
    for(int i(0); i < n;i++){
        int all = 0;
        for(int j(0); j < v[i].size();j++){
            int now = get_num(v[i][j]);
            for(int e(0); e < 4;e++){
                if(e == now)continue;
                all+=cnt[j][e];
            }
        }
        //cout << i+1 << ' ' << all << ' ' << need << endl;
        if(all!=need)continue;
        bool f = 1;
        for(int j(0); j < n;j++){
            if(i == j)continue;
            if(!cmp(v[i],v[j])){
                f = 0;
                break;
            }
        }
        if(f){
            cout << i+1;
            return 0;
        }
    }
    return 0;
}
/*
*/

Compilation message

genetics.cpp: In function 'bool cmp(std::__cxx11::string&, std::__cxx11::string&)':
genetics.cpp:17:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i(0); i < a.size();i++){
                   ~~^~~~~~~~~~
genetics.cpp: At global scope:
genetics.cpp:30:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
genetics.cpp: In function 'int main()':
genetics.cpp:44:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j(0); j < s.size();j++){
                       ~~^~~~~~~~~~
genetics.cpp:50:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j(0); j < v[i].size();j++){
                       ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 380 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 380 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 634 ms 3192 KB Output is correct
2 Correct 58 ms 3704 KB Output is correct
3 Correct 68 ms 3576 KB Output is correct
4 Correct 22 ms 1020 KB Output is correct
5 Correct 45 ms 3704 KB Output is correct
6 Correct 47 ms 3704 KB Output is correct
7 Correct 30 ms 1784 KB Output is correct
8 Correct 27 ms 1784 KB Output is correct
9 Correct 35 ms 3448 KB Output is correct
10 Correct 496 ms 3448 KB Output is correct
11 Correct 172 ms 3064 KB Output is correct
12 Correct 46 ms 3064 KB Output is correct
13 Correct 136 ms 3064 KB Output is correct
14 Correct 192 ms 2808 KB Output is correct
15 Correct 98 ms 2808 KB Output is correct
16 Correct 37 ms 2680 KB Output is correct
17 Correct 59 ms 3576 KB Output is correct
18 Correct 36 ms 3456 KB Output is correct
19 Correct 54 ms 3576 KB Output is correct
20 Correct 39 ms 3448 KB Output is correct
21 Correct 52 ms 3576 KB Output is correct
22 Correct 66 ms 3448 KB Output is correct
23 Correct 65 ms 3580 KB Output is correct
24 Correct 68 ms 3576 KB Output is correct
25 Correct 41 ms 3576 KB Output is correct
26 Correct 51 ms 3576 KB Output is correct
27 Correct 48 ms 3576 KB Output is correct
28 Correct 45 ms 3448 KB Output is correct
29 Correct 56 ms 3576 KB Output is correct
30 Correct 29 ms 3704 KB Output is correct
31 Correct 41 ms 3576 KB Output is correct
32 Correct 44 ms 3708 KB Output is correct
33 Correct 5 ms 376 KB Output is correct
34 Correct 5 ms 376 KB Output is correct
35 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 634 ms 3192 KB Output is correct
2 Correct 58 ms 3704 KB Output is correct
3 Correct 68 ms 3576 KB Output is correct
4 Correct 22 ms 1020 KB Output is correct
5 Correct 45 ms 3704 KB Output is correct
6 Correct 47 ms 3704 KB Output is correct
7 Correct 30 ms 1784 KB Output is correct
8 Correct 27 ms 1784 KB Output is correct
9 Correct 35 ms 3448 KB Output is correct
10 Correct 496 ms 3448 KB Output is correct
11 Correct 172 ms 3064 KB Output is correct
12 Correct 46 ms 3064 KB Output is correct
13 Correct 136 ms 3064 KB Output is correct
14 Correct 192 ms 2808 KB Output is correct
15 Correct 98 ms 2808 KB Output is correct
16 Correct 37 ms 2680 KB Output is correct
17 Correct 59 ms 3576 KB Output is correct
18 Correct 36 ms 3456 KB Output is correct
19 Correct 54 ms 3576 KB Output is correct
20 Correct 39 ms 3448 KB Output is correct
21 Correct 52 ms 3576 KB Output is correct
22 Correct 66 ms 3448 KB Output is correct
23 Correct 65 ms 3580 KB Output is correct
24 Correct 68 ms 3576 KB Output is correct
25 Correct 41 ms 3576 KB Output is correct
26 Correct 51 ms 3576 KB Output is correct
27 Correct 48 ms 3576 KB Output is correct
28 Correct 45 ms 3448 KB Output is correct
29 Correct 56 ms 3576 KB Output is correct
30 Correct 29 ms 3704 KB Output is correct
31 Correct 41 ms 3576 KB Output is correct
32 Correct 44 ms 3708 KB Output is correct
33 Correct 5 ms 376 KB Output is correct
34 Correct 5 ms 376 KB Output is correct
35 Correct 5 ms 376 KB Output is correct
36 Execution timed out 2078 ms 15096 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 380 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 380 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 634 ms 3192 KB Output is correct
19 Correct 58 ms 3704 KB Output is correct
20 Correct 68 ms 3576 KB Output is correct
21 Correct 22 ms 1020 KB Output is correct
22 Correct 45 ms 3704 KB Output is correct
23 Correct 47 ms 3704 KB Output is correct
24 Correct 30 ms 1784 KB Output is correct
25 Correct 27 ms 1784 KB Output is correct
26 Correct 35 ms 3448 KB Output is correct
27 Correct 496 ms 3448 KB Output is correct
28 Correct 172 ms 3064 KB Output is correct
29 Correct 46 ms 3064 KB Output is correct
30 Correct 136 ms 3064 KB Output is correct
31 Correct 192 ms 2808 KB Output is correct
32 Correct 98 ms 2808 KB Output is correct
33 Correct 37 ms 2680 KB Output is correct
34 Correct 59 ms 3576 KB Output is correct
35 Correct 36 ms 3456 KB Output is correct
36 Correct 54 ms 3576 KB Output is correct
37 Correct 39 ms 3448 KB Output is correct
38 Correct 52 ms 3576 KB Output is correct
39 Correct 66 ms 3448 KB Output is correct
40 Correct 65 ms 3580 KB Output is correct
41 Correct 68 ms 3576 KB Output is correct
42 Correct 41 ms 3576 KB Output is correct
43 Correct 51 ms 3576 KB Output is correct
44 Correct 48 ms 3576 KB Output is correct
45 Correct 45 ms 3448 KB Output is correct
46 Correct 56 ms 3576 KB Output is correct
47 Correct 29 ms 3704 KB Output is correct
48 Correct 41 ms 3576 KB Output is correct
49 Correct 44 ms 3708 KB Output is correct
50 Correct 5 ms 376 KB Output is correct
51 Correct 5 ms 376 KB Output is correct
52 Correct 5 ms 376 KB Output is correct
53 Execution timed out 2078 ms 15096 KB Time limit exceeded
54 Halted 0 ms 0 KB -