제출 #307089

#제출 시각아이디문제언어결과실행 시간메모리
307089RainbowbunnyGenetics (BOI18_genetics)C++17
100 / 100
905 ms148900 KiB
#include <bits/stdc++.h> #define int long long #define mp make_pair #define eb emplace_back #define fi first #define se second using namespace std; using cd = complex <double>; typedef pair <int, int> pii; const int N = 3e3 + 5; const long long INF = 1e18; const int mod = 1e9 + 123;//786433;//998244353; const double Pi = acos(-1); const int p = 510200; void Fastio() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } int n, m, k; int a[4105][4105]; int x[4105]; int f[4105][4]; signed main() { Fastio(); cin >> n >> m >> k; x[0] = 1; for(int i = 1; i < n; i++) { x[i] = 1ll * x[i - 1] * p % mod; } for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { char temp; cin >> temp; if(temp == 'A') { a[i][j] = 0; } else if(temp == 'T') { a[i][j] = 1; } else if(temp == 'G') { a[i][j] = 2; } else { a[i][j] = 3; } f[j][a[i][j]] += x[i]; f[j][a[i][j]] %= mod; } } for(int i = 0; i < n; i++) { int temp = 0, cur = 0; for(int j = 0; j < m; j++) { for(int t = 0; t < 4; t++) { if(t != a[i][j]) { temp = temp + f[j][t]; temp = (temp + mod) % mod; } } } for(int j = 0; j < n; j++) { if(j != i) { int r = 1ll * (x[j] * k) % mod; cur = (cur % mod + r + mod) % mod; } } if(temp == cur) { cout << i + 1; 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...