Submission #1010155

#TimeUsernameProblemLanguageResultExecution timeMemory
1010155alexddGenetics (BOI18_genetics)C++17
100 / 100
244 ms36432 KiB
#include<bits/stdc++.h> using namespace std; #define int long long const int MOD = 1e9+9; int n,m,k; string s[4105]; int cnt[4105][4]; int r[4105]; mt19937 rnd(time(0)); signed main() { ios_base::sync_with_stdio(0);cin.tie(0); cin>>n>>m>>k; int tot=0; for(int i=1;i<=n;i++) { cin>>s[i]; r[i] = rnd()%MOD; tot += r[i]*k; for(int j=0;j<m;j++) { if(s[i][j]=='A') s[i][j]=0; else if(s[i][j]=='C') s[i][j]=1; else if(s[i][j]=='G') s[i][j]=2; else s[i][j]=3; cnt[j][s[i][j]] += r[i]; } } for(int i=1;i<=n;i++) { int sum=0; for(int j=0;j<m;j++) { for(int c=0;c<4;c++) if(c!=s[i][j]) sum += cnt[j][c]; } if(sum + r[i]*k == tot) { cout<<i; return 0; } } return 0; }

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:27:27: warning: array subscript has type 'char' [-Wchar-subscripts]
   27 |             cnt[j][s[i][j]] += r[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...