제출 #838081

#제출 시각아이디문제언어결과실행 시간메모리
838081jasminDNA 돌연변이 (IOI21_dna)C++17
0 / 100
23 ms6284 KiB
//IOI 2021 #include<bits/stdc++.h> using namespace std; const int N=1e5+5; int cnta[N][3]; int cntb[N][3]; int ps[N]; void init(string a, string b){ int n=a.size(); vector<int> enc = {'A', 'C', 'T'}; for(int i=0; i<n; i++){ for(int j=0; j<3; j++){ cnta[i+1][j] = cnta[i][j-1]; cntb[i+1][j] = cntb[i][j-1]; if(a[i] == enc[j]){ cnta[i+1][j]++; } if(b[i] == enc[j]){ cntb[i+1][j]++; } } } for(int i=0; i<n; i++){ ps[i+1] = ps[i] + (a[i]!=b[i]); } } int get_distance(int x, int y){ for(int j=0; j<3; j++){ if(cnta[y+1][j]-cnta[x][j] != cntb[y+1][j]-cntb[x][j]){ return -1; } } int ans = (ps[y+1] - ps[x] + 1)/2; return ans; }
#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...