#include<bits/stdc++.h>
using namespace std;
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define sz size()
#define x first
#define y second
#define pi pair <int, int>
#define pii pair <pi, int>
#define vi vector <int>
const ll mod = 1000000007;
#define int ll
int n, m, k;
string s[101];
bitset <4101> ss[4101];
int gcd(int a, int b){
if(a==0) return b;
else return gcd(b%a, a);
}
int32_t main(){
ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
cin>>n>>m>>k;
if(n<=100 && m<=100){
for(int i=1; i<=n; i++) cin>>s[i];
for(int i=1; i<=n; i++){
bool ctrl=1;
for(int j=1; j<=n; j++){
if(j!=i){
int dif=0;
for(int ix=0; ix<m; ix++)
if(s[i][ix]!=s[j][ix]) dif++;
if(dif!=k){
ctrl=0;
continue;
}
}
}
if(ctrl) return cout<<i, 0;
}
}
for(int i=0; i<n; i++){
string xd;
cin>>xd;
for(int j=0; j<m; j++) ss[i][j]=(xd[j]=='A');
}
for(int i=0; i<n; i++){
bool ctrl=1;
for(int j=0; j<n; j++){
if(i!=j){
if((ss[i]^ss[j]).count()!=k){
//cout<<i<<" "<<j<<" "<<(ss[i]^ss[j]).count()<<endl;
ctrl=0;
continue;
}
}
}
if(ctrl) return cout<<i+1, 0;
}
}
Compilation message
genetics.cpp: In function 'int32_t main()':
genetics.cpp:54:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if((ss[i]^ss[j]).count()!=k){
~~~~~~~~~~~~~~~~~~~~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
380 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 |
6 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 |
376 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 |
6 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
4 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
683 ms |
1144 KB |
Output is correct |
2 |
Correct |
685 ms |
2040 KB |
Output is correct |
3 |
Correct |
897 ms |
2040 KB |
Output is correct |
4 |
Correct |
369 ms |
1400 KB |
Output is correct |
5 |
Correct |
124 ms |
2040 KB |
Output is correct |
6 |
Correct |
373 ms |
2040 KB |
Output is correct |
7 |
Correct |
174 ms |
1400 KB |
Output is correct |
8 |
Correct |
149 ms |
1272 KB |
Output is correct |
9 |
Correct |
48 ms |
1912 KB |
Output is correct |
10 |
Correct |
687 ms |
2040 KB |
Output is correct |
11 |
Correct |
437 ms |
1912 KB |
Output is correct |
12 |
Correct |
65 ms |
1912 KB |
Output is correct |
13 |
Correct |
200 ms |
1784 KB |
Output is correct |
14 |
Correct |
481 ms |
1784 KB |
Output is correct |
15 |
Correct |
118 ms |
1656 KB |
Output is correct |
16 |
Correct |
216 ms |
1784 KB |
Output is correct |
17 |
Correct |
691 ms |
2040 KB |
Output is correct |
18 |
Correct |
52 ms |
1912 KB |
Output is correct |
19 |
Correct |
614 ms |
2040 KB |
Output is correct |
20 |
Correct |
189 ms |
2040 KB |
Output is correct |
21 |
Correct |
586 ms |
2040 KB |
Output is correct |
22 |
Correct |
852 ms |
2040 KB |
Output is correct |
23 |
Correct |
889 ms |
2040 KB |
Output is correct |
24 |
Correct |
861 ms |
2040 KB |
Output is correct |
25 |
Correct |
222 ms |
1912 KB |
Output is correct |
26 |
Correct |
418 ms |
1912 KB |
Output is correct |
27 |
Correct |
373 ms |
2040 KB |
Output is correct |
28 |
Correct |
348 ms |
2040 KB |
Output is correct |
29 |
Correct |
704 ms |
2040 KB |
Output is correct |
30 |
Correct |
194 ms |
2040 KB |
Output is correct |
31 |
Correct |
594 ms |
2168 KB |
Output is correct |
32 |
Correct |
281 ms |
2040 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
683 ms |
1144 KB |
Output is correct |
2 |
Correct |
685 ms |
2040 KB |
Output is correct |
3 |
Correct |
897 ms |
2040 KB |
Output is correct |
4 |
Correct |
369 ms |
1400 KB |
Output is correct |
5 |
Correct |
124 ms |
2040 KB |
Output is correct |
6 |
Correct |
373 ms |
2040 KB |
Output is correct |
7 |
Correct |
174 ms |
1400 KB |
Output is correct |
8 |
Correct |
149 ms |
1272 KB |
Output is correct |
9 |
Correct |
48 ms |
1912 KB |
Output is correct |
10 |
Correct |
687 ms |
2040 KB |
Output is correct |
11 |
Correct |
437 ms |
1912 KB |
Output is correct |
12 |
Correct |
65 ms |
1912 KB |
Output is correct |
13 |
Correct |
200 ms |
1784 KB |
Output is correct |
14 |
Correct |
481 ms |
1784 KB |
Output is correct |
15 |
Correct |
118 ms |
1656 KB |
Output is correct |
16 |
Correct |
216 ms |
1784 KB |
Output is correct |
17 |
Correct |
691 ms |
2040 KB |
Output is correct |
18 |
Correct |
52 ms |
1912 KB |
Output is correct |
19 |
Correct |
614 ms |
2040 KB |
Output is correct |
20 |
Correct |
189 ms |
2040 KB |
Output is correct |
21 |
Correct |
586 ms |
2040 KB |
Output is correct |
22 |
Correct |
852 ms |
2040 KB |
Output is correct |
23 |
Correct |
889 ms |
2040 KB |
Output is correct |
24 |
Correct |
861 ms |
2040 KB |
Output is correct |
25 |
Correct |
222 ms |
1912 KB |
Output is correct |
26 |
Correct |
418 ms |
1912 KB |
Output is correct |
27 |
Correct |
373 ms |
2040 KB |
Output is correct |
28 |
Correct |
348 ms |
2040 KB |
Output is correct |
29 |
Correct |
704 ms |
2040 KB |
Output is correct |
30 |
Correct |
194 ms |
2040 KB |
Output is correct |
31 |
Correct |
594 ms |
2168 KB |
Output is correct |
32 |
Correct |
281 ms |
2040 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 |
Correct |
1976 ms |
3680 KB |
Output is correct |
37 |
Correct |
1757 ms |
3652 KB |
Output is correct |
38 |
Execution timed out |
2057 ms |
3832 KB |
Time limit exceeded |
39 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
380 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 |
6 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 |
376 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 |
6 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
4 ms |
376 KB |
Output is correct |
18 |
Correct |
683 ms |
1144 KB |
Output is correct |
19 |
Correct |
685 ms |
2040 KB |
Output is correct |
20 |
Correct |
897 ms |
2040 KB |
Output is correct |
21 |
Correct |
369 ms |
1400 KB |
Output is correct |
22 |
Correct |
124 ms |
2040 KB |
Output is correct |
23 |
Correct |
373 ms |
2040 KB |
Output is correct |
24 |
Correct |
174 ms |
1400 KB |
Output is correct |
25 |
Correct |
149 ms |
1272 KB |
Output is correct |
26 |
Correct |
48 ms |
1912 KB |
Output is correct |
27 |
Correct |
687 ms |
2040 KB |
Output is correct |
28 |
Correct |
437 ms |
1912 KB |
Output is correct |
29 |
Correct |
65 ms |
1912 KB |
Output is correct |
30 |
Correct |
200 ms |
1784 KB |
Output is correct |
31 |
Correct |
481 ms |
1784 KB |
Output is correct |
32 |
Correct |
118 ms |
1656 KB |
Output is correct |
33 |
Correct |
216 ms |
1784 KB |
Output is correct |
34 |
Correct |
691 ms |
2040 KB |
Output is correct |
35 |
Correct |
52 ms |
1912 KB |
Output is correct |
36 |
Correct |
614 ms |
2040 KB |
Output is correct |
37 |
Correct |
189 ms |
2040 KB |
Output is correct |
38 |
Correct |
586 ms |
2040 KB |
Output is correct |
39 |
Correct |
852 ms |
2040 KB |
Output is correct |
40 |
Correct |
889 ms |
2040 KB |
Output is correct |
41 |
Correct |
861 ms |
2040 KB |
Output is correct |
42 |
Correct |
222 ms |
1912 KB |
Output is correct |
43 |
Correct |
418 ms |
1912 KB |
Output is correct |
44 |
Correct |
373 ms |
2040 KB |
Output is correct |
45 |
Correct |
348 ms |
2040 KB |
Output is correct |
46 |
Correct |
704 ms |
2040 KB |
Output is correct |
47 |
Correct |
194 ms |
2040 KB |
Output is correct |
48 |
Correct |
594 ms |
2168 KB |
Output is correct |
49 |
Correct |
281 ms |
2040 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 |
Correct |
1976 ms |
3680 KB |
Output is correct |
54 |
Correct |
1757 ms |
3652 KB |
Output is correct |
55 |
Execution timed out |
2057 ms |
3832 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |