Submission #1303354

#TimeUsernameProblemLanguageResultExecution timeMemory
1303354liangjeremyGenetics (BOI18_genetics)C++20
100 / 100
265 ms19996 KiB
#include<bits/stdc++.h> //#include<bits/extc++.h> #define fi first #define se second #define int long long using namespace std; //using namespace __gnu_pbds; using db=double; using ll=int64_t; using sll=__int128; using lb=long double; mt19937 rng(random_device{}()); uniform_int_distribution<int>gen(-1e18,1e18); int32_t main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,m,k; cin>>n>>m>>k; vector<string>a(n); vector<int>w(n); int tot=0; for(int i=0; i<n; i++){ cin>>a[i]; w[i]=gen(rng); tot+=w[i]; } auto id=[&](char c){ if(c=='A')return 0; if(c=='C')return 1; if(c=='G')return 2; if(c=='T')return 3; }; vector<vector<int>>v(4,vector<int>(m)); for(int i=0; i<n; i++){ for(int j=0; j<m; j++){ v[id(a[i][j])][j]+=w[i]; } } for(int i=0; i<n; i++){ int cur=0; for(int j=0; j<m; j++){ for(int k=0; k<4; k++){ if(k==id(a[i][j]))continue; cur+=v[k][j]; } } if(k*(tot-w[i])==cur){ cout<<i+1<<'\n'; return 0; } } } /* Overhead the albatross hangs motionless upon the air And deep beneath the rolling waves in labyrinths of coral caves The echo of a distant time comes willowing across the sand And everything is green and submarine And no one showed us to the land And no one knows the wheres or whys But something stirs and something tries And starts to climb towards the light */

Compilation message (stderr)

genetics.cpp: In lambda function:
genetics.cpp:25:3: warning: control reaches end of non-void function [-Wreturn-type]
   25 |   };
      |   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...