This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2", "popcnt")
#include <string>
#include <bits/functexcept.h>
#include <iosfwd>
#include <bits/cxxabi_forced.h>
#include <bits/functional_hash.h>
#pragma push_macro("__SIZEOF_LONG__")
#pragma push_macro("__cplusplus")
#define __SIZEOF_LONG__ __SIZEOF_LONG_LONG__
#define unsigned unsigned long
#define __cplusplus 201102L
#define __builtin_popcountl __builtin_popcountll
#define __builtin_ctzl __builtin_ctzll
#include <bitset>
#pragma pop_macro("__cplusplus")
#pragma pop_macro("__SIZEOF_LONG__")
#undef unsigned
#undef __builtin_popcountl
#undef __builtin_ctzl
#include <bits/stdc++.h>
using namespace std;
const int Z = 4100;
int N, M, K;
bitset<Z*4> a[Z];
int g[100];
bool chk[Z][Z]; int cnt[Z][Z];
int main() {
ios::sync_with_stdio(0), cin.tie(0);
g['C'] = 1;
g['G'] = 2;
g['T'] = 3;
cin >> N >> M >> K;
for(int i = 0; i < N; ++i) {
string inp; cin >> inp;
for(int j = 0; j < M; ++j)
a[i][g[inp[j]] * Z + j] = 1;
}
int o[N];
iota(o, o + N, 0);
stable_partition(o, o + N, [](const int &i) {
return ((i ^ 1024) > N / 2);
});
for(int &i : o) {
bool ok = 1;
a[i].flip();
for(int j = 0; j < N; ++j) if(i != j) {
int c = (chk[i][j] ? cnt[i][j] : (a[i] & a[j]).count());
chk[i][j] = chk[j][i] = 1;
cnt[i][j] = cnt[j][i] = c;
if(c != K) {
ok = 0;
break;
}
}
if(ok) {
cout << i + 1;
return 0;
}
a[i].flip();
}
}
Compilation message (stderr)
genetics.cpp:11: warning: "__SIZEOF_LONG__" redefined
11 | #define __SIZEOF_LONG__ __SIZEOF_LONG_LONG__
|
<built-in>: note: this is the location of the previous definition
genetics.cpp:13: warning: "__cplusplus" redefined
13 | #define __cplusplus 201102L
|
<built-in>: note: this is the location of the previous definition
genetics.cpp: In function 'int main()':
genetics.cpp:50:17: warning: array subscript has type 'char' [-Wchar-subscripts]
50 | a[i][g[inp[j]] * Z + j] = 1;
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |