제출 #752878

#제출 시각아이디문제언어결과실행 시간메모리
752878inventiontimeGenetics (BOI18_genetics)C++17
27 / 100
2080 ms3028 KiB
#include <bits/stdc++.h>
using namespace std;

#define int ll
#define endl '\n' //comment for interactive
#define fast_io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define pb push_back
#define re resize
#define ff first
#define ss second

#define all(x) (x).begin(), (x).end()
#define all1(x) (x).begin()+1, (x).end()
#define loop(i, n) for(int i = 0; i < n; i++)
#define loop1(i, n) for(int i = 1; i <= n; i++)

#define print(x) cout << #x << ": " << x << endl << flush

typedef long long ll;
typedef vector<int> vi;
typedef array<int, 2> ii;
typedef array<int, 3> ti;
typedef vector<ii> vii;
typedef vector<ti> vti;
typedef vector<vi> vvi;
typedef priority_queue<int> pq;

template<class T> bool ckmin(T&a, T b) { bool B = a > b; a = min(a, b); return B; }
template<class T> bool ckmax(T&a, T b) { bool B = a < b; a = max(a, b); return B; }

const int inf = 1e17;

void solve() {

    int n, m, k;
    cin >> n >> m >> k;
    vector<string> s(n+1);
    loop1(i, n) cin >> s[i];
    int res = -1;
    loop1(i, n) {
        bool valid = true;
        loop1(j, n) if(i != j) {
            int cnt = 0;
            loop(l, m) {
                if(s[i][l] != s[j][l]) cnt++;
            }
            if(cnt != k) valid = false;
        }
        if(valid) res = i;
    }
    cout << res << endl;

}

signed main() {

    fast_io;

    int t = 1; //cin >> t;
    while(t--)
        solve();

    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...