Submission #1274693

#TimeUsernameProblemLanguageResultExecution timeMemory
1274693DanielPr8Genetics (BOI18_genetics)C++20
46 / 100
2098 ms70412 KiB
#include <bits/stdc++.h>
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll_loops")
// #pragma GCC target("avx2")
using namespace std;
using ll = int;
using vll = vector<ll>;
using pll = pair<ll,ll>;
using vpl = vector<pll>;
using vvl =vector<vll>;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(),v.end()
vector<bitset<4100>> lw1, lw2;
vvl p;
ll calc(ll i, ll j){
    if(p[i][j]!=-1)return p[i][j];
    return p[i][j]=p[j][i]=((lw1[i]^lw1[j])|(lw2[i]^lw2[j])).count();
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(NULL);
    ll n, m, k;
    cin >> n >> m >> k;
    lw1 = lw2 = vector<bitset<4100>>(n);
    for(ll i = 0; i < n; ++i){
        for(ll j = 0; j < m; ++j){
            char c;
            cin >> c;
            if(c=='C' || c=='A')lw1[i][j]=1;
            if(c=='T' || c=='A')lw2[i][j]=1;
        }
    }
    vll ord(n);
    iota(all(ord),0);
    random_device g;
    shuffle(all(ord), g);
    p = vvl(n, vll(n, -1));
    for(ll i: ord){
        ll o=0;
        for(ll j: ord){
            if(j==i)continue;
            if(calc(i, j)!=k){
                o=1;
                break;
            }
        }
        if(!o){cout << i+1;break;}
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...