Submission #1091583

#TimeUsernameProblemLanguageResultExecution timeMemory
1091583MateiKing80Genetics (BOI18_genetics)C++14
100 / 100
256 ms33388 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define int ll mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int rangerng(int l, int r) { return uniform_int_distribution<int> (l, r)(rng); } int n, m, k; char a[4102][4102]; int Rnd[4102], P[4102]; int S[4102]; void solve() { cin >> n >> m >> k; for(int i = 1; i <= n; i ++) for(int j = 1; j <= m; j ++) cin >> a[i][j]; for(int j = 1; j <= m; j ++) { int All = 0; S['A'] = S['G'] = S['T'] = S['C'] = 0; for(int i = 1; i <= n; i ++) { All += Rnd[i]; S[a[i][j]] += Rnd[i]; } for(int i = 1; i <= n; i ++) P[i] += All - S[a[i][j]]; } int Sum = 0; for(int i = 1; i <= n; i ++) Sum += 1ll * Rnd[i] * k; for(int i = 1; i <= n; i ++) { int w = 1ll * Rnd[i] * k; if(P[i] == Sum - w) { cout << i; return; } } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); for(int i = 1; i <= 4100; i ++) Rnd[i] = rangerng(1, 1e18); solve(); return 0; }

Compilation message (stderr)

genetics.cpp: In function 'void solve()':
genetics.cpp:35:21: warning: array subscript has type 'char' [-Wchar-subscripts]
   35 |             S[a[i][j]] += Rnd[i];
      |               ~~~~~~^
genetics.cpp:38:35: warning: array subscript has type 'char' [-Wchar-subscripts]
   38 |             P[i] += All - S[a[i][j]];
      |                             ~~~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...