이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
const int base = 31;
char c[4] = {'A' , 'C' , 'G' , 'T'};
string s[N];
main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n , m , k; cin >> n >> m >> k;
vector <long long> pow(n + 1); vector <vector <int>> ans(m + 1 , vector <int> (4));
for(int i = 1; i <= n; i++) cin >> s[i] , s[i] = ' ' + s[i];
pow[0] = 1;
for(int i = 1; i <= n; i++) pow[i] = (pow[i -1] * base) % mod;
for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) for(int d = 0; d < 4; d++) if(s[i][j] != c[d]) ans[j][d] = (ans[j][d] + pow[i]) % mod;
for(int i = 1; i <= n; i++) {
int sum = 0; int tmp = 0;
for(int j = 1; j <= n; j++) if(i != j) sum = (sum + pow[j] * k) % mod;
for(int j = 1; j <= m; j++) for(int d = 0; d < 4; d++) if(s[i][j] == c[d]) tmp = (tmp + ans[j][d]) % mod;
if(tmp == sum) cout << i;
}
return 0x0;
}
컴파일 시 표준 에러 (stderr) 메시지
genetics.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
12 | main() {
| ^~~~| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |