# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
532698 | fatemetmhr | Genetics (BOI18_genetics) | C++17 | 2062 ms | 13868 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int maxn5 = 5e3 + 10;
string s;
bitset <4105> a[maxn5], tmp;
int av[maxn5], per[maxn5];
int n, m, k, sz;
inline bool ok(int i, int j){
tmp = a[i] ^ a[j];
//cout << i << ' ' << j << ' ' << tmp.count() << endl;
return tmp.count() == k;
}
inline void rem(int v){
//cout << "removing " << v << endl;
bool re = false;
for(int i = 0; i < sz; i++){
if(re)
per[i - 1] = per[i];
if(per[i] == v)
re = true;
}
if(re)
sz--;
//cout << sz << endl;
}
inline void check(int v){
for(int i = 0; i < n; i++)
av[i] = i;
shuffle(av, av + n, rng);
for(int i = 0; i < n; i++)
if(v != av[i] && !ok(v, av[i])){
rem(av[i]);
return;
}
cout << v + 1 << endl;
exit(0);
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin >> n >> m >> k;
for(int i = 0; i < n; i++){
cin >> s;
for(int j = 0; j < m; j++)
if(s[j] == 'A')
a[i][j] = 1;
per[i] = i;
}
sz = n;
while(true){
int v = per[rng() % sz];
check(v);
rem(v);
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |