답안 #62823

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
62823 2018-07-30T11:21:59 Z SpaimaCarpatilor Genetics (BOI18_genetics) C++17
100 / 100
421 ms 21068 KB
#include<bits/stdc++.h>

using namespace std;

int N, M, K;
char sir[5009][5009];
long long coef[5000], f[5009][4];

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

int rand15 () {return rand () & 32767;}
int rand30 () {return (rand15 () << 15) | rand15 ();}
long long rand60 () {return ((long long) rand30 () * (1LL << 30)) | rand30 ();}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

srand (time (0));
scanf ("%d %d %d\n", &N, &M, &K);
for (int i=1; i<=N; i++)
    coef[i] = rand60 ();
for (int i=1; i<=N; i++)
{
    scanf ("%s", sir[i] + 1);
    for (int j=1; j<=M; j++)
        sir[i][j] = code (sir[i][j]),
        f[j][sir[i][j]] += coef[i];
}
for (int i=1; i<=N; i++)
{
    long long needed = 0, curr = 0;
    for (int j=1; j<=N; j++)
        if (j != i)
            needed += 1LL * K * coef[j];
    for (int j=1; j<=M; j++)
        for (int k=0; k<4; k++)
            if (k != sir[i][j])
                curr += f[j][k];
    if (curr == needed)
    {
        printf ("%d\n", i);
        return 0;
    }
}
return 0;
}

Compilation message

genetics.cpp: In function 'int main()':
genetics.cpp:35:23: warning: array subscript has type 'char' [-Wchar-subscripts]
         f[j][sir[i][j]] += coef[i];
                       ^
genetics.cpp:27:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf ("%d %d %d\n", &N, &M, &K);
 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
genetics.cpp:32:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%s", sir[i] + 1);
     ~~~~~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 632 KB Output is correct
2 Correct 5 ms 760 KB Output is correct
3 Correct 5 ms 368 KB Output is correct
4 Correct 5 ms 632 KB Output is correct
5 Correct 5 ms 760 KB Output is correct
6 Correct 5 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 5 ms 636 KB Output is correct
10 Correct 5 ms 760 KB Output is correct
11 Correct 5 ms 632 KB Output is correct
12 Correct 6 ms 760 KB Output is correct
13 Correct 5 ms 760 KB Output is correct
14 Correct 5 ms 760 KB Output is correct
15 Correct 5 ms 760 KB Output is correct
16 Correct 5 ms 760 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 8056 KB Output is correct
2 Correct 56 ms 9464 KB Output is correct
3 Correct 71 ms 9080 KB Output is correct
4 Correct 22 ms 5880 KB Output is correct
5 Correct 48 ms 9464 KB Output is correct
6 Correct 58 ms 9464 KB Output is correct
7 Correct 33 ms 4344 KB Output is correct
8 Correct 31 ms 4344 KB Output is correct
9 Correct 42 ms 9080 KB Output is correct
10 Correct 63 ms 9084 KB Output is correct
11 Correct 52 ms 8184 KB Output is correct
12 Correct 39 ms 8056 KB Output is correct
13 Correct 43 ms 8056 KB Output is correct
14 Correct 52 ms 7032 KB Output is correct
15 Correct 37 ms 7032 KB Output is correct
16 Correct 42 ms 7844 KB Output is correct
17 Correct 64 ms 9208 KB Output is correct
18 Correct 44 ms 8952 KB Output is correct
19 Correct 63 ms 9080 KB Output is correct
20 Correct 47 ms 8952 KB Output is correct
21 Correct 63 ms 9080 KB Output is correct
22 Correct 70 ms 9080 KB Output is correct
23 Correct 71 ms 9080 KB Output is correct
24 Correct 70 ms 9080 KB Output is correct
25 Correct 48 ms 8952 KB Output is correct
26 Correct 56 ms 9080 KB Output is correct
27 Correct 55 ms 9036 KB Output is correct
28 Correct 53 ms 8952 KB Output is correct
29 Correct 62 ms 9080 KB Output is correct
30 Correct 41 ms 9464 KB Output is correct
31 Correct 53 ms 9468 KB Output is correct
32 Correct 55 ms 9464 KB Output is correct
33 Correct 5 ms 508 KB Output is correct
34 Correct 5 ms 760 KB Output is correct
35 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 8056 KB Output is correct
2 Correct 56 ms 9464 KB Output is correct
3 Correct 71 ms 9080 KB Output is correct
4 Correct 22 ms 5880 KB Output is correct
5 Correct 48 ms 9464 KB Output is correct
6 Correct 58 ms 9464 KB Output is correct
7 Correct 33 ms 4344 KB Output is correct
8 Correct 31 ms 4344 KB Output is correct
9 Correct 42 ms 9080 KB Output is correct
10 Correct 63 ms 9084 KB Output is correct
11 Correct 52 ms 8184 KB Output is correct
12 Correct 39 ms 8056 KB Output is correct
13 Correct 43 ms 8056 KB Output is correct
14 Correct 52 ms 7032 KB Output is correct
15 Correct 37 ms 7032 KB Output is correct
16 Correct 42 ms 7844 KB Output is correct
17 Correct 64 ms 9208 KB Output is correct
18 Correct 44 ms 8952 KB Output is correct
19 Correct 63 ms 9080 KB Output is correct
20 Correct 47 ms 8952 KB Output is correct
21 Correct 63 ms 9080 KB Output is correct
22 Correct 70 ms 9080 KB Output is correct
23 Correct 71 ms 9080 KB Output is correct
24 Correct 70 ms 9080 KB Output is correct
25 Correct 48 ms 8952 KB Output is correct
26 Correct 56 ms 9080 KB Output is correct
27 Correct 55 ms 9036 KB Output is correct
28 Correct 53 ms 8952 KB Output is correct
29 Correct 62 ms 9080 KB Output is correct
30 Correct 41 ms 9464 KB Output is correct
31 Correct 53 ms 9468 KB Output is correct
32 Correct 55 ms 9464 KB Output is correct
33 Correct 5 ms 508 KB Output is correct
34 Correct 5 ms 760 KB Output is correct
35 Correct 5 ms 376 KB Output is correct
36 Correct 235 ms 18272 KB Output is correct
37 Correct 209 ms 20984 KB Output is correct
38 Correct 337 ms 20344 KB Output is correct
39 Correct 105 ms 17528 KB Output is correct
40 Correct 286 ms 21068 KB Output is correct
41 Correct 147 ms 10744 KB Output is correct
42 Correct 124 ms 10744 KB Output is correct
43 Correct 165 ms 17656 KB Output is correct
44 Correct 222 ms 20856 KB Output is correct
45 Correct 286 ms 20728 KB Output is correct
46 Correct 210 ms 20860 KB Output is correct
47 Correct 252 ms 18324 KB Output is correct
48 Correct 281 ms 18296 KB Output is correct
49 Correct 166 ms 15864 KB Output is correct
50 Correct 235 ms 15864 KB Output is correct
51 Correct 249 ms 17656 KB Output is correct
52 Correct 314 ms 20428 KB Output is correct
53 Correct 314 ms 20344 KB Output is correct
54 Correct 169 ms 20472 KB Output is correct
55 Correct 265 ms 20344 KB Output is correct
56 Correct 210 ms 20344 KB Output is correct
57 Correct 342 ms 20344 KB Output is correct
58 Correct 264 ms 20344 KB Output is correct
59 Correct 228 ms 20216 KB Output is correct
60 Correct 223 ms 20500 KB Output is correct
61 Correct 232 ms 20216 KB Output is correct
62 Correct 217 ms 20344 KB Output is correct
63 Correct 209 ms 20428 KB Output is correct
64 Correct 215 ms 20344 KB Output is correct
65 Correct 309 ms 20344 KB Output is correct
66 Correct 303 ms 20344 KB Output is correct
67 Correct 293 ms 20344 KB Output is correct
68 Correct 259 ms 20344 KB Output is correct
69 Correct 197 ms 20344 KB Output is correct
70 Correct 301 ms 20344 KB Output is correct
71 Correct 259 ms 20304 KB Output is correct
72 Correct 262 ms 20424 KB Output is correct
73 Correct 292 ms 20412 KB Output is correct
74 Correct 5 ms 376 KB Output is correct
75 Correct 5 ms 760 KB Output is correct
76 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 632 KB Output is correct
2 Correct 5 ms 760 KB Output is correct
3 Correct 5 ms 368 KB Output is correct
4 Correct 5 ms 632 KB Output is correct
5 Correct 5 ms 760 KB Output is correct
6 Correct 5 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 5 ms 636 KB Output is correct
10 Correct 5 ms 760 KB Output is correct
11 Correct 5 ms 632 KB Output is correct
12 Correct 6 ms 760 KB Output is correct
13 Correct 5 ms 760 KB Output is correct
14 Correct 5 ms 760 KB Output is correct
15 Correct 5 ms 760 KB Output is correct
16 Correct 5 ms 760 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 61 ms 8056 KB Output is correct
19 Correct 56 ms 9464 KB Output is correct
20 Correct 71 ms 9080 KB Output is correct
21 Correct 22 ms 5880 KB Output is correct
22 Correct 48 ms 9464 KB Output is correct
23 Correct 58 ms 9464 KB Output is correct
24 Correct 33 ms 4344 KB Output is correct
25 Correct 31 ms 4344 KB Output is correct
26 Correct 42 ms 9080 KB Output is correct
27 Correct 63 ms 9084 KB Output is correct
28 Correct 52 ms 8184 KB Output is correct
29 Correct 39 ms 8056 KB Output is correct
30 Correct 43 ms 8056 KB Output is correct
31 Correct 52 ms 7032 KB Output is correct
32 Correct 37 ms 7032 KB Output is correct
33 Correct 42 ms 7844 KB Output is correct
34 Correct 64 ms 9208 KB Output is correct
35 Correct 44 ms 8952 KB Output is correct
36 Correct 63 ms 9080 KB Output is correct
37 Correct 47 ms 8952 KB Output is correct
38 Correct 63 ms 9080 KB Output is correct
39 Correct 70 ms 9080 KB Output is correct
40 Correct 71 ms 9080 KB Output is correct
41 Correct 70 ms 9080 KB Output is correct
42 Correct 48 ms 8952 KB Output is correct
43 Correct 56 ms 9080 KB Output is correct
44 Correct 55 ms 9036 KB Output is correct
45 Correct 53 ms 8952 KB Output is correct
46 Correct 62 ms 9080 KB Output is correct
47 Correct 41 ms 9464 KB Output is correct
48 Correct 53 ms 9468 KB Output is correct
49 Correct 55 ms 9464 KB Output is correct
50 Correct 5 ms 508 KB Output is correct
51 Correct 5 ms 760 KB Output is correct
52 Correct 5 ms 376 KB Output is correct
53 Correct 235 ms 18272 KB Output is correct
54 Correct 209 ms 20984 KB Output is correct
55 Correct 337 ms 20344 KB Output is correct
56 Correct 105 ms 17528 KB Output is correct
57 Correct 286 ms 21068 KB Output is correct
58 Correct 147 ms 10744 KB Output is correct
59 Correct 124 ms 10744 KB Output is correct
60 Correct 165 ms 17656 KB Output is correct
61 Correct 222 ms 20856 KB Output is correct
62 Correct 286 ms 20728 KB Output is correct
63 Correct 210 ms 20860 KB Output is correct
64 Correct 252 ms 18324 KB Output is correct
65 Correct 281 ms 18296 KB Output is correct
66 Correct 166 ms 15864 KB Output is correct
67 Correct 235 ms 15864 KB Output is correct
68 Correct 249 ms 17656 KB Output is correct
69 Correct 314 ms 20428 KB Output is correct
70 Correct 314 ms 20344 KB Output is correct
71 Correct 169 ms 20472 KB Output is correct
72 Correct 265 ms 20344 KB Output is correct
73 Correct 210 ms 20344 KB Output is correct
74 Correct 342 ms 20344 KB Output is correct
75 Correct 264 ms 20344 KB Output is correct
76 Correct 228 ms 20216 KB Output is correct
77 Correct 223 ms 20500 KB Output is correct
78 Correct 232 ms 20216 KB Output is correct
79 Correct 217 ms 20344 KB Output is correct
80 Correct 209 ms 20428 KB Output is correct
81 Correct 215 ms 20344 KB Output is correct
82 Correct 309 ms 20344 KB Output is correct
83 Correct 303 ms 20344 KB Output is correct
84 Correct 293 ms 20344 KB Output is correct
85 Correct 259 ms 20344 KB Output is correct
86 Correct 197 ms 20344 KB Output is correct
87 Correct 301 ms 20344 KB Output is correct
88 Correct 259 ms 20304 KB Output is correct
89 Correct 262 ms 20424 KB Output is correct
90 Correct 292 ms 20412 KB Output is correct
91 Correct 5 ms 376 KB Output is correct
92 Correct 5 ms 760 KB Output is correct
93 Correct 5 ms 376 KB Output is correct
94 Correct 228 ms 19704 KB Output is correct
95 Correct 265 ms 20928 KB Output is correct
96 Correct 421 ms 20600 KB Output is correct
97 Correct 224 ms 11384 KB Output is correct
98 Correct 133 ms 17528 KB Output is correct
99 Correct 313 ms 20856 KB Output is correct
100 Correct 175 ms 10744 KB Output is correct
101 Correct 149 ms 10744 KB Output is correct
102 Correct 189 ms 17656 KB Output is correct
103 Correct 248 ms 20748 KB Output is correct
104 Correct 367 ms 20856 KB Output is correct
105 Correct 418 ms 20728 KB Output is correct
106 Correct 396 ms 19960 KB Output is correct
107 Correct 201 ms 18296 KB Output is correct
108 Correct 215 ms 15736 KB Output is correct
109 Correct 290 ms 18040 KB Output is correct
110 Correct 329 ms 17656 KB Output is correct
111 Correct 270 ms 20984 KB Output is correct
112 Correct 344 ms 20472 KB Output is correct
113 Correct 300 ms 20472 KB Output is correct
114 Correct 168 ms 20472 KB Output is correct
115 Correct 359 ms 20344 KB Output is correct
116 Correct 378 ms 20728 KB Output is correct
117 Correct 355 ms 20472 KB Output is correct
118 Correct 350 ms 20600 KB Output is correct
119 Correct 305 ms 20532 KB Output is correct
120 Correct 367 ms 20756 KB Output is correct
121 Correct 235 ms 18168 KB Output is correct
122 Correct 209 ms 20728 KB Output is correct
123 Correct 335 ms 20216 KB Output is correct
124 Correct 5 ms 376 KB Output is correct
125 Correct 5 ms 760 KB Output is correct
126 Correct 5 ms 376 KB Output is correct