답안 #135677

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
135677 2019-07-24T09:40:24 Z Plurm Genetics (BOI18_genetics) C++11
46 / 100
2000 ms 20124 KB
#include <bits/stdc++.h>
using namespace std;
char dna[4200][4200];
bitset<4200> enc1[4200];
bitset<4200> enc2[4200];
int cnt[4200][4];
inline int getMask(int x){
    switch(x){
        case 'A':
        return 0;
        case 'T':
        return 1;
        case 'C':
        return 2;
        case 'G':
        return 3;
    }
}
int main(){
    int n,m,k;
    scanf("%d%d%d",&n,&m,&k);
    for(int i = 1; i <= n; i++){
        scanf("%s",dna[i]+1);
        for(int j = 1; j <= m; j++){
            cnt[j][getMask(dna[i][j])]++;
            if(dna[i][j] == 'A' || dna[i][j] == 'T'){
                enc1[i][j] = 0;
            }else{
                enc1[i][j] = 1;
            }
            if(dna[i][j] == 'A' || dna[i][j] == 'C'){
                enc2[i][j] = 0;
            }else{
                enc2[i][j] = 1;
            }
        }
    }
    vector<int> v;
    for(int i = 1; i <= n; i++){
        int diffcnt = 0;
        int ccnt = 0;
        int nx = i % n + 1;
        for(int j = 1; j <= m; j++){
            diffcnt += n - cnt[j][getMask(dna[i][j])];
            if(dna[i][j] != dna[nx][j]) ccnt++;
        }
        if(true){
            v.push_back(i);
        }
    }
    for(int i : v){
        bool ok = true;
        for(int o = 1; o <= n; o++){
            if(o == i) continue;
            int cur = ((enc1[i] ^ enc1[o]) | (enc2[i] ^ enc2[o])).count();
            if(cur != k){
                ok = false;
                break;
            }
        }
        if(ok){
            printf("%d\n",i);
            return 0;
        }
    }
}

Compilation message

genetics.cpp: In function 'int main()':
genetics.cpp:21: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);
     ~~~~~^~~~~~~~~~~~~~~~~~~
genetics.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",dna[i]+1);
         ~~~~~^~~~~~~~~~~~~~~
genetics.cpp: In function 'int getMask(int)':
genetics.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 760 KB Output is correct
2 Correct 5 ms 888 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 7 ms 632 KB Output is correct
5 Correct 7 ms 760 KB Output is correct
6 Correct 7 ms 760 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 6 ms 632 KB Output is correct
10 Correct 6 ms 760 KB Output is correct
11 Correct 5 ms 760 KB Output is correct
12 Correct 11 ms 764 KB Output is correct
13 Correct 5 ms 888 KB Output is correct
14 Correct 5 ms 888 KB Output is correct
15 Correct 5 ms 888 KB Output is correct
16 Correct 5 ms 888 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 940 ms 8288 KB Output is correct
2 Correct 579 ms 9696 KB Output is correct
3 Correct 1493 ms 9260 KB Output is correct
4 Correct 293 ms 6264 KB Output is correct
5 Correct 124 ms 9592 KB Output is correct
6 Correct 341 ms 9696 KB Output is correct
7 Correct 152 ms 4344 KB Output is correct
8 Correct 136 ms 4344 KB Output is correct
9 Correct 47 ms 9336 KB Output is correct
10 Correct 885 ms 9336 KB Output is correct
11 Correct 213 ms 8188 KB Output is correct
12 Correct 58 ms 8184 KB Output is correct
13 Correct 189 ms 8204 KB Output is correct
14 Correct 447 ms 7160 KB Output is correct
15 Correct 161 ms 7160 KB Output is correct
16 Correct 245 ms 8056 KB Output is correct
17 Correct 505 ms 9228 KB Output is correct
18 Correct 88 ms 9208 KB Output is correct
19 Correct 550 ms 9212 KB Output is correct
20 Correct 304 ms 9208 KB Output is correct
21 Correct 834 ms 9208 KB Output is correct
22 Correct 1240 ms 9208 KB Output is correct
23 Correct 1341 ms 9336 KB Output is correct
24 Correct 748 ms 9228 KB Output is correct
25 Correct 124 ms 9208 KB Output is correct
26 Correct 603 ms 9240 KB Output is correct
27 Correct 358 ms 9208 KB Output is correct
28 Correct 295 ms 9080 KB Output is correct
29 Correct 820 ms 9236 KB Output is correct
30 Correct 39 ms 10360 KB Output is correct
31 Correct 43 ms 10388 KB Output is correct
32 Correct 54 ms 10360 KB Output is correct
33 Correct 6 ms 376 KB Output is correct
34 Correct 5 ms 888 KB Output is correct
35 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 940 ms 8288 KB Output is correct
2 Correct 579 ms 9696 KB Output is correct
3 Correct 1493 ms 9260 KB Output is correct
4 Correct 293 ms 6264 KB Output is correct
5 Correct 124 ms 9592 KB Output is correct
6 Correct 341 ms 9696 KB Output is correct
7 Correct 152 ms 4344 KB Output is correct
8 Correct 136 ms 4344 KB Output is correct
9 Correct 47 ms 9336 KB Output is correct
10 Correct 885 ms 9336 KB Output is correct
11 Correct 213 ms 8188 KB Output is correct
12 Correct 58 ms 8184 KB Output is correct
13 Correct 189 ms 8204 KB Output is correct
14 Correct 447 ms 7160 KB Output is correct
15 Correct 161 ms 7160 KB Output is correct
16 Correct 245 ms 8056 KB Output is correct
17 Correct 505 ms 9228 KB Output is correct
18 Correct 88 ms 9208 KB Output is correct
19 Correct 550 ms 9212 KB Output is correct
20 Correct 304 ms 9208 KB Output is correct
21 Correct 834 ms 9208 KB Output is correct
22 Correct 1240 ms 9208 KB Output is correct
23 Correct 1341 ms 9336 KB Output is correct
24 Correct 748 ms 9228 KB Output is correct
25 Correct 124 ms 9208 KB Output is correct
26 Correct 603 ms 9240 KB Output is correct
27 Correct 358 ms 9208 KB Output is correct
28 Correct 295 ms 9080 KB Output is correct
29 Correct 820 ms 9236 KB Output is correct
30 Correct 39 ms 10360 KB Output is correct
31 Correct 43 ms 10388 KB Output is correct
32 Correct 54 ms 10360 KB Output is correct
33 Correct 6 ms 376 KB Output is correct
34 Correct 5 ms 888 KB Output is correct
35 Correct 5 ms 376 KB Output is correct
36 Execution timed out 2036 ms 20124 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 760 KB Output is correct
2 Correct 5 ms 888 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 7 ms 632 KB Output is correct
5 Correct 7 ms 760 KB Output is correct
6 Correct 7 ms 760 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 6 ms 632 KB Output is correct
10 Correct 6 ms 760 KB Output is correct
11 Correct 5 ms 760 KB Output is correct
12 Correct 11 ms 764 KB Output is correct
13 Correct 5 ms 888 KB Output is correct
14 Correct 5 ms 888 KB Output is correct
15 Correct 5 ms 888 KB Output is correct
16 Correct 5 ms 888 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 940 ms 8288 KB Output is correct
19 Correct 579 ms 9696 KB Output is correct
20 Correct 1493 ms 9260 KB Output is correct
21 Correct 293 ms 6264 KB Output is correct
22 Correct 124 ms 9592 KB Output is correct
23 Correct 341 ms 9696 KB Output is correct
24 Correct 152 ms 4344 KB Output is correct
25 Correct 136 ms 4344 KB Output is correct
26 Correct 47 ms 9336 KB Output is correct
27 Correct 885 ms 9336 KB Output is correct
28 Correct 213 ms 8188 KB Output is correct
29 Correct 58 ms 8184 KB Output is correct
30 Correct 189 ms 8204 KB Output is correct
31 Correct 447 ms 7160 KB Output is correct
32 Correct 161 ms 7160 KB Output is correct
33 Correct 245 ms 8056 KB Output is correct
34 Correct 505 ms 9228 KB Output is correct
35 Correct 88 ms 9208 KB Output is correct
36 Correct 550 ms 9212 KB Output is correct
37 Correct 304 ms 9208 KB Output is correct
38 Correct 834 ms 9208 KB Output is correct
39 Correct 1240 ms 9208 KB Output is correct
40 Correct 1341 ms 9336 KB Output is correct
41 Correct 748 ms 9228 KB Output is correct
42 Correct 124 ms 9208 KB Output is correct
43 Correct 603 ms 9240 KB Output is correct
44 Correct 358 ms 9208 KB Output is correct
45 Correct 295 ms 9080 KB Output is correct
46 Correct 820 ms 9236 KB Output is correct
47 Correct 39 ms 10360 KB Output is correct
48 Correct 43 ms 10388 KB Output is correct
49 Correct 54 ms 10360 KB Output is correct
50 Correct 6 ms 376 KB Output is correct
51 Correct 5 ms 888 KB Output is correct
52 Correct 5 ms 376 KB Output is correct
53 Execution timed out 2036 ms 20124 KB Time limit exceeded
54 Halted 0 ms 0 KB -