이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define int long long
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int GetRand(int l,int r){
return (rng()%(r-l+1))+l;
}
signed main(){
int n,m,k;
cin >> n >> m >> k;
char grid[n][m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin >> grid[i][j];
}
}
int val[n];
int pre[m][4];
int sum=0;
memset(pre,0,sizeof(pre));
for(int i=0;i<n;i++){
val[i]=GetRand(1,1e12);
sum+=val[i];
}
for(int j=0;j<m;j++){
for(int i=0;i<n;i++){
if(grid[i][j]=='A'){
pre[j][0]+=val[i];
}
else if(grid[i][j]=='C'){
pre[j][1]+=val[i];
}
else if(grid[i][j]=='G'){
pre[j][2]+=val[i];
}
else{
pre[j][3]+=val[i];
}
}
}
for(int i=0;i<n;i++){
int curr=0;
for(int j=0;j<m;j++){
curr+=sum;
if(grid[i][j]=='A'){
curr-=pre[j][0];
}
else if(grid[i][j]=='C'){
curr-=pre[j][1];
}
else if(grid[i][j]=='G'){
curr-=pre[j][2];
}
else{
curr-=pre[j][3];
}
}
if(curr==(sum-val[i])*k){
cout << i+1;
break;
}
}
}
# | 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... |