제출 #1018297

#제출 시각아이디문제언어결과실행 시간메모리
1018297andrewpDNA 돌연변이 (IOI21_dna)C++17
0 / 100
20 ms7516 KiB
#include "dna.h" #include "bits/stdc++.h" using namespace std; const int mxN=2e5+1; int ps[mxN][3][2], pr[mxN]; void init(string a, string b) { int n=a.size(); a='i'+a, b='i'+b; for(int i=1; i<=n; ++i) { ps[i][0][0]=ps[i-1][0][0]; ps[i][1][0]=ps[i-1][1][0]; ps[i][2][0]=ps[i-1][2][0]; ps[i][0][1]=ps[i-1][0][1]; ps[i][1][1]=ps[i-1][1][1]; ps[i][2][1]=ps[i-1][2][1]; if(a[i]=='A') ++ps[i][0][0]; else if(a[i]=='C') ++ps[i][1][0]; else ++ps[i][2][0]; if(b[i]=='A') ++ps[i][0][1]; else if(b[i]=='C') ++ps[i][1][1]; else ++ps[i][2][1]; pr[i]=pr[i-1]+(a[i]!=b[i]); } } int get_distance(int x, int y) { for(int i=0; i<3; ++i) { if((ps[y][i][0]-ps[x-1][i][0])!=(ps[y][i][1]-ps[x-1][i][1])) { return -1; } } return (pr[y]-pr[x-1]+1)/2; } //int main() { // int n, q; // cin >> n >> q; // string a, b; // cin >> a >> b; // init(a, b); // cout << get_distance(4, 6) << "\n"; // //}
#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...