Submission #378267

#TimeUsernameProblemLanguageResultExecution timeMemory
378267negar_aGenetics (BOI18_genetics)C++14
100 / 100
385 ms19948 KiB
//!yrt tsuj uoy srettam gnihton no emoc #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define pb push_back #define mp make_pair #define pii pair <int, int> #define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define F first #define S second mt19937 Rnd(time(0)); const int maxn = 4100 + 5; int n, m, k; ll id[maxn], sm[maxn][5]; ll base = 31; string s[maxn]; int main(){ fast_io; cin >> n >> m >> k; ll tot = 0; ll x = 1; for(int i = 0; i < n; i ++){ cin >> s[i]; id[i] = x; x *= base; for(int j = 0; j < m; j ++){ if(s[i][j] == 'A'){ sm[j][0] += id[i]; s[i][j] = '0'; } else if(s[i][j] == 'C'){ sm[j][1] += id[i]; s[i][j] = '1'; } else if(s[i][j] == 'T'){ sm[j][2] += id[i]; s[i][j] = '2'; } else if(s[i][j] == 'G'){ sm[j][3] += id[i]; s[i][j] = '3'; } } tot += id[i]; } for(int i = 0; i < n; i ++){ ll sum = 0; for(int j = 0; j < m; j ++){ int c = s[i][j] - '0'; // cout << "c : " << c << endl; for(int t = 0; t < 4; t ++){ if(c != t){ sum += sm[j][t]; } } } // cout << i << " " << sum << " | " << (tot - id[i]) * k << endl; if((tot - id[i]) * k == sum){ cout << i + 1; 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...