이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |