Submission #535943

#TimeUsernameProblemLanguageResultExecution timeMemory
535943groshiGenetics (BOI18_genetics)C++17
100 / 100
146 ms36224 KiB
#include<iostream> #include <stdlib.h> #include <time.h> using namespace std; long long litery[30][6000]; long long los[6000]; string t[6000]; int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); srand(time(0)); long long n,m,k; cin>>n>>m>>k; long long suma_ogolna=0; for(int i=1;i<=n;i++) { los[i]=rand()%1000000000; suma_ogolna+=los[i]; } for(int i=1;i<=n;i++) { cin>>t[i]; for(int j=0;j<m;j++) litery[t[i][j]-'A'][j]+=los[i]; } for(int i=1;i<=n;i++) { long long suma=0; for(int j=0;j<m;j++) suma+=litery[t[i][j]-'A'][j]-los[i]; if((suma_ogolna-los[i])*(m-k)==suma) { cout<<i; return 0; } } 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...