제출 #1053999

#제출 시각아이디문제언어결과실행 시간메모리
1053999LuvidiDNA 돌연변이 (IOI21_dna)C++17
35 / 100
22 ms7448 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; const int maxn=1e5; int pre[maxn+1][3][3]; void init(std::string a, std::string b) { map<char,int> m; m['A']=0; m['T']=1; m['C']=2; int n=a.length(); for(int i=1;i<=n;i++){ for(int j=0;j<3;j++){ for(int k=0;k<3;k++){ pre[i][j][k]=pre[i-1][j][k]; } } pre[i][m[a[i-1]]][m[b[i-1]]]++; } } int get_distance(int x, int y) { int cnt[3][3],c[3]={0,0,0}; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ cnt[i][j]=pre[y+1][i][j]-pre[x][i][j]; c[i]+=cnt[i][j]; c[j]-=cnt[i][j]; } } for(int i=0;i<3;i++){ if(c[i])return -1; } return (cnt[0][1]+cnt[1][0])/2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...