이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int func(char ch){
if(ch == 'A')
return 0;
if(ch == 'C')
return 1;
if(ch == 'G')
return 2;
return 3;
}
vector <int> v;
int mat[4][4100][4100];
long long aux[4][4100], rez[4100];
inline bool ok(int i, int m, int k, int n){
long long loc = 0;
for(int j = 0; j < n; j++){
if(j != i)
loc += 1LL * (m - k) * v[j];
else
loc += 1LL * m * v[j];
}
return loc == rez[i];
}
int main()
{
int n, m, k;
char ch;
cin >> n >> m >> k;
srand(time(NULL));
v.resize(n);
for(auto &e : v)
e = rand();
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> ch;
ch = func(ch);
mat[ch][i][j] = 1;
}
}
for(int i = 0; i < n; i++)
for(int j = 0; j < m; j++)
for(int cul = 0; cul < 4; cul++)
aux[cul][j] += 1LL * mat[cul][i][j] * v[i];
for(int i = 0; i < n; i++)
for(int j = 0; j < m; j++)
for(int cul = 0; cul < 4; cul++)
rez[i] += 1LL * mat[cul][i][j] * aux[cul][j];
int i = 0;
while(i < n && !ok(i, m, k, n)){
i++;
}
cout << i + 1;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
genetics.cpp: In function 'int main()':
genetics.cpp:43:19: warning: array subscript has type 'char' [-Wchar-subscripts]
mat[ch][i][j] = 1;
^
# | 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... |