제출 #541287

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
5412872022-03-22 22:54:27AlesL0DNA 돌연변이 (IOI21_dna)C++17
0 / 100
33 ms6528 KiB
#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int n;
vector <int> a1, a2, t1, t2, c1, c2, f;
void init(string a, string b){
s1 = a; s2 = b;
n = s1.size();
a1.resize(n+1); a2.resize(n+1); t1.resize(n+1); t2.resize(n+1); c1.resize(n+1); c2.resize(n+1); f.resize(n+1);
a1[0] = 0; a2[0] = 0; t1[0] = 0; t2[0] = 0; c1[0] = 0; c2[0] = 0; f[0] = 0;
for (int i = 0; i < n; i++){
a1[i+1] = a1[i]; a2[i+1] = a2[i]; t1[i+1] = t1[i]; t2[i+1] = t1[i]; c1[i+1] = c1[i]; c2[i+1] = c2[i]; f[i+1] = f[i];
if (s1[i] == 'A')a1[i+1]++;
else if (s1[i] == 'T')t1[i+1]++;
else c1[i+1]++;
if (s2[i] == 'A')a2[i+1]++;
else if (s2[i] == 'T')t2[i+1]++;
else c2[i+1]++;
if (s1[i] != s2[i])f[i+1]++;
}
}
int get_distance(int x, int y){
if ((a1[y+1]-a1[x])==(a2[y+1]-a2[x]) && (t1[y+1]-t1[x])==(t2[y+1]-t2[x]) && (c1[y+1]-c1[x])==(c2[y+1]-c2[x])){
int h = f[y+1]-f[x];
return ((h+h%2)/2);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...