제출 #601449

#제출 시각아이디문제언어결과실행 시간메모리
601449penguinhackerGenetics (BOI18_genetics)C++17
100 / 100
142 ms36264 KiB
#include <bits/stdc++.h> #pragma GCC target("popcnt") using namespace std; #define ll long long #define ar array #define ull unsigned ll mt19937_64 rng(42); const int mxN=4100; int n, m, k, mp[256]; string s[mxN]; ull w[mxN], w_sum, dp[mxN][4]; int main() { ios::sync_with_stdio(0); cin.tie(0); mp['A']=0, mp['C']=1, mp['T']=2, mp['G']=3; cin >> n >> m >> k; for (int i=0; i<n; ++i) { cin >> s[i]; w[i]=rng(); w_sum+=w[i]; for (int j=0; j<m; ++j) dp[j][mp[s[i][j]]]+=w[i]; } for (int i=0; i<n; ++i) { ull hsh=0; for (int j=0; j<m; ++j) hsh+=dp[j][mp[s[i][j]]]-w[i]; if (hsh==(m-k)*(w_sum-w[i])) { cout << i+1; return 0; } } return 0; }

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

genetics.cpp: In function 'int main()':
genetics.cpp:26:20: warning: array subscript has type 'char' [-Wchar-subscripts]
   26 |    dp[j][mp[s[i][j]]]+=w[i];
      |                    ^
genetics.cpp:31:25: warning: array subscript has type 'char' [-Wchar-subscripts]
   31 |    hsh+=dp[j][mp[s[i][j]]]-w[i];
      |                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...