# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
117493 | ckodser | Genetics (BOI18_genetics) | C++14 | 1256 ms | 24356 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
#define ll int
#define pb push_back
#define ld long double
#define mp make_pair
#define F first
#define S second
#define pii pair<ll,ll>
using namespace :: std;
const ll maxn=4110;
const ll maxg=30;
string s[maxn];
bool hast[maxg][maxn];
ll sz[maxg];
ll cnt[maxg][maxn][4];
ll n,m,k;
bool canBeAns(ll i){
for(ll y=0;y<maxg;y++){
ll ans=0;
ll szz=sz[y];
for(ll j=0;j<m;j++){
ans+=cnt[y][j][s[i][j]];
}
if(hast[y][i]){
ans-=m;
szz--;
}
if(ans!=szz*(m-k)){
return 0;
}
}
return 1;
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n>>m>>k;
for(ll i=0;i<n;i++){
cin>>s[i];
}
for(ll i=0;i<n;i++){
for(ll j=0;j<m;j++){
if(s[i][j]=='A')s[i][j]=0;
if(s[i][j]=='C')s[i][j]=1;
if(s[i][j]=='T')s[i][j]=2;
if(s[i][j]=='G')s[i][j]=3;
}
for(ll y=0;y<maxg;y++){
if(rand()%2==0){
hast[y][i]=1;
sz[y]++;
for(ll j=0;j<m;j++){
cnt[y][j][s[i][j]]++;
}
}
}
}
for(ll i=0;i<n;i++){
if(canBeAns(i)){
cout<<i+1;
return 0;
}
}
}
Compilation message (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... |