Submission #1093629

#TimeUsernameProblemLanguageResultExecution timeMemory
1093629vjudge1Genetics (BOI18_genetics)C++17
100 / 100
285 ms30148 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<long long, long long> #define pb push_back #define F first #define S second #define all(x) (x).begin(), (x).end() const ll N = 4200; const ll inf = 1e18; const ll mod = 1e9 + 7; const ll block = 350; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll get_rand(ll l, ll r) { assert(l <= r); return uniform_int_distribution<ll> (l, r)(rng); } ll n,m,k; ll r[N], cnt[N], res[N]; char a[N][N]; void to_thic_cau(){ cin >> n >> m >> k; for(int i = 1; i <= n;i++){ for(int j = 1; j <= m;j++) cin >> a[i][j]; } for(int i = 1; i <= n;i++) r[i] = get_rand(1,(ll)1e12); for(int j = 1; j <= m;j++){ cnt['A'] = cnt['T'] = cnt['G'] = cnt['C'] = 0; ll tot = 0; for(int i = 1; i <= n;i++){ cnt[int(a[i][j])] += r[i]; tot += r[i]; } for(int i = 1; i <= n;i++) res[i] += tot - cnt[int(a[i][j])]; } ll tot = 0; for(int i = 1; i <= n;i++) tot += r[i]; for(int i = 1; i <= n;i++){ if(res[i] == (tot - r[i]) * k){ cout << i << '\n'; return; } } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); ll tc = 1; //cin >> tc; while(tc--) to_thic_cau(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...