Submission #483559

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4835592021-10-30 17:05:52M_WMutating DNA (IOI21_dna)C++17
100 / 100
40 ms6212 KiB
#include <bits/stdc++.h>
using namespace std;
int qs[100001][6]; // AT, TA, AC, CA, CT, TC
void init(string a, string b){
int len = a.size();
for(int i = 1; i <= len; i++){
for(int j = 0; j < 6; j++) qs[i][j] = qs[i - 1][j];
if(a[i - 1] == 'A'){
if(b[i - 1] == 'C') qs[i][2]++;
else if(b[i - 1] == 'T') qs[i][0]++;
}
else if(a[i - 1] == 'T'){
if(b[i - 1] == 'A') qs[i][1]++;
else if(b[i - 1] == 'C') qs[i][5]++;
}
else{
if(b[i - 1] == 'A') qs[i][3]++;
else if(b[i - 1] == 'T') qs[i][4]++;
}
}
}
int get_distance(int a, int b){
a++; b++;
int AT = qs[b][0] - qs[a - 1][0];
int TA = qs[b][1] - qs[a - 1][1];
int AC = qs[b][2] - qs[a - 1][2];
int CA = qs[b][3] - qs[a - 1][3];
int CT = qs[b][4] - qs[a - 1][4];
int TC = qs[b][5] - qs[a - 1][5];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...