Submission #878244

#TimeUsernameProblemLanguageResultExecution timeMemory
878244vjudge1Genetics (BOI18_genetics)C++17
0 / 100
206 ms7192 KiB
#include<bits/stdc++.h>
     
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
 
#define pb              push_back
#define F               first
#define S               second
//#define mp              make_pair
#define all(x)          x.begin(),x.end()
#define file            freopen("closing.in", "r", stdin);freopen("closing.out", "w", stdout);
#define kill(x)         {cout << x << '\n'; return 0;}
//#define int                ll

#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("avx2")

const int N =  4e3 + 110, LG = 18, MOD = 1e9+9;
const ll inf = 1e12;

int n, m, k;
string s[N];
bitset<N> b[N], mark;

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);
    
    cin >> n >> m >> k;
    bool l = 0;
    for(int i = 0; i < n; ++i) {
        cin >> s[i];
        for(int j = 0; j < m; ++j) {
            if(s[i][j] != 'A' && s[i][j] != 'C') {l = 1; continue;}
            s[i][j] == 'A' ? b[i][j] = 1 : b[i][j] = 0;
        }
    }   
    if(l) {
        for(int i = 0; i < n; ++i) {
            int cnt = 0;
            bool check = 0;        
            for(int j = 0; j < n; ++j) {
                cnt = 0;
                for(int kk = 0; kk < m; ++kk)  if(s[i][kk] != s[j][kk]) ++cnt;
                if((cnt > k || cnt < k) && i != j) {
                    check = 1;
                    break;
                }
            }
            if(!check) kill(i+1);
        }
    }
        
    for(int i = 0; i < n; ++i) {
        if(!mark[i]) {
            for(int j = 0; j < m; ++j) {
                bitset<N> a = b[i] ^ b[j];
                int x = a.count();
                if(x != k) {
                    mark[i] = mark[j] = 1;
                    break;
                }
            }
            if(!mark[i]) kill(i+1);
        }
    }

    

    return 0;
} 
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...