제출 #1354585

#제출 시각아이디문제언어결과실행 시간메모리
1354585AksLolCodingGenetics (BOI18_genetics)C++17
0 / 100
16 ms3296 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

mt19937_64 rng((ll)new char);
string str = "ACTG";

void solve() {
    int n, m, k;
    cin >> m >> n >> k;
    string s[n];
    for (int i = 0; i < n; i++) cin >> s[i];

    // solve
    ll h[n], sum = 0;
    for (int i = 0; i < n; i++) sum += h[i] = rng();
    ll sm[m][4] = {{}};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            for (int c = 0; c < 4; c++) {
                if (s[i][j] == str[c]) {
                    sm[j][c] += h[i];
                }
            }
        }
    }
    for (int i = 0; i < n; i++) {
        ll cur = 0;
        for (int j = 0; j < m; j++) {
            for (int c = 0; c < 4; c++) {
                if (s[i][j] != str[c]) cur += sm[j][c];
            }
        }
        ll want = (sum - h[i]) * k;
        if (cur == want) {
            cout << i+1 << '\n';
            return;
        }
    }
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...