This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
const ll mod = 998244353;
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define faster ios::sync_with_stdio(false);cin.tie(nullptr)
int main() {
random_device seed_gen;
mt19937 engine(seed_gen());
uniform_real_distribution<float> dist(0,1);
ll N,M,K;
cin >> N >> M >> K;
vector<string> s(N);
rep(i,N){
cin >> s[i];
}
vector<ll> P(N);
ll sum=0;
rep(i,N) P[i]=mod*dist(engine),sum+=P[i];
vector<vector<ll>> cum(M,vector<ll>(4,0));
rep(i,N){
rep(j,M){
if(s[i][j]=='A') cum[j][0]+=P[i];
if(s[i][j]=='C') cum[j][1]+=P[i];
if(s[i][j]=='G') cum[j][2]+=P[i];
if(s[i][j]=='T') cum[j][3]+=P[i];
}
}
rep(i,N){
ll cnt=0;
rep(j,M){
if(s[i][j]!='A') cnt+=cum[j][0];
if(s[i][j]!='C') cnt+=cum[j][1];
if(s[i][j]!='G') cnt+=cum[j][2];
if(s[i][j]!='T') cnt+=cum[j][3];
}
if(cnt%mod==((sum-P[i])*K)%mod){
cout << i+1 << endl;
}
}
return 0;
}
# | 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... |