제출 #482516

#제출 시각아이디문제언어결과실행 시간메모리
482516chenwzGenetics (BOI18_genetics)C++11
100 / 100
783 ms73192 KiB
#include <bits/stdc++.h> typedef long long LL; #define _for(i, a, b) for (int i = (a); i < (int)(b); ++i) using namespace std; const int NN = 4100 + 4; int V[NN][NN]; LL Sum[NN][4], W[NN]; LL randl() { return ((LL)rand() << 32) + rand(); } map<char, int> CM = {{'A', 0}, {'C', 1}, {'G', 2}, {'T', 3}}; int main() { ios::sync_with_stdio(false), cin.tie(0); LL n, m, k, ans = 0; cin >> n >> m >> k; string s; _for(i, 0, n) { W[i] = randl(), cin >> s; _for(j, 0, m) { int &v = V[i][j]; v = CM[s[j]]; for (int c = 0; c < 4; c++) if (c != v) Sum[j][c] += W[i]; } ans += W[i] * k; } _for(i, 0, n) { LL s = W[i] * k; _for(j, 0, m) s += Sum[j][V[i][j]]; if (s == ans) { cout << i + 1 << endl; break; } } 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...