Submission #440030

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4400302021-07-01 13:03:50algorithm16Mutating DNA (IOI21_dna)C++17
100 / 100
67 ms8752 KiB
#include "dna.h"
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string a1,b1,s="ACT";
int n,cnt[3][2][100005],p[3][3][100005];
int get_cnt(int ind1,int ind2,int l,int r) {
if(!l) return cnt[ind1][ind2][r];
return cnt[ind1][ind2][r]-cnt[ind1][ind2][l-1];
}
int get_p(int ind1,int ind2,int l,int r) {
if(!l) return p[ind1][ind2][r];
return p[ind1][ind2][r]-p[ind1][ind2][l-1];
}
void init(std::string a, std::string b) {
n=a.size();
for(int i=0;i<n;i++) {
for(int j=0;j<3;j++) {
if(a[i]==s[j]) cnt[j][0][i]=1;
if(b[i]==s[j]) cnt[j][1][i]=1;
}
for(int j=0;j<3;j++) {
for(int k=0;k<2;k++) {
if(i) cnt[j][k][i]+=cnt[j][k][i-1];
}
}
for(int j=0;j<3;j++) {
for(int k=0;k<3;k++) {
if(j!=k && a[i]==s[j] && b[i]==s[k]) p[j][k][i]=1;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...