제출 #853521

#제출 시각아이디문제언어결과실행 시간메모리
853521Trisanu_DasGenetics (BOI18_genetics)C++17
100 / 100
503 ms33648 KiB
// Editorial OP! #include <bits/stdc++.h> using namespace std; const int N = 4105; int n, m, k, sum[N], val[N], f[4][N]; char a[N][N]; int toint (char c) { if (c == 'A') return 0; if (c == 'C') return 1; if (c == 'G') return 2; return 3; } int main(){ mt19937 rd(chrono::steady_clock::now().time_since_epoch().count()); cin >> n >> m >> k; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) val[i] = rd() % 100000 + 1; for (int i = 0; i < m; i++) for (int j = 1; j <= n; j++) f[toint(a[j][i])][i] += val[j]; for (int i = 1; i <= n; i++) { for (int j = 0; j < m; j++) for (int k = 0; k < 4; k++) if (k != toint(a[i][j])) sum[i] += f[k][j]; int cur = 0; for (int j = 1; j <= n; j++) if (i != j) cur += val[j]; if (sum[i] == k * cur) { cout << i << '\n'; 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...