제출 #140823

#제출 시각아이디문제언어결과실행 시간메모리
140823MinnakhmetovGenetics (BOI18_genetics)C++14
100 / 100
318 ms21496 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define all(aaa) aaa.begin(), aaa.end() const int N = 4105, K = 4; string s[N], let = "ACGT"; ll b[N][K], w[N]; signed main() { #ifdef HOME freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); int n, m, k; cin >> n >> m >> k; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); ll hash_sum = 0; for (int i = 0; i < n; i++) { while (s[i].empty()) getline(cin, s[i]); w[i] = rng(); hash_sum += w[i] * k; for (int j = 0; j < m; j++) { s[i][j] = find(all(let), s[i][j]) - let.begin(); b[j][s[i][j]] += w[i]; } } for (int i = 0; i < m; i++) { ll sum = 0; for (int j = 0; j < K; j++) { sum += b[i][j]; } for (int j = 0; j < K; j++) { b[i][j] = sum - b[i][j]; } } for (int i = 0; i < n; i++) { ll sum = 0; for (int j = 0; j < m; j++) { sum += b[j][s[i][j]]; } if (sum == hash_sum - k * w[i]) { cout << i + 1 << "\n"; return 0; } } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

genetics.cpp: In function 'int main()':
genetics.cpp:36:25: warning: array subscript has type 'char' [-Wchar-subscripts]
             b[j][s[i][j]] += w[i];
                         ^
genetics.cpp:53:32: warning: array subscript has type 'char' [-Wchar-subscripts]
             sum += b[j][s[i][j]];
                                ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...