Submission #440008

#TimeUsernameProblemLanguageResultExecution timeMemory
440008ala2Mutating DNA (IOI21_dna)C++17
35 / 100
52 ms4356 KiB
#include "dna.h" #include <iostream> using namespace std; string s="",c=""; int a2[1001000]; int b2[1001000]; int ca[1000100]; int ct[1000100]; void init(string a, string b) { s=a; c=b; int n=s.size(); int g=0; int A=0,T=0; for(int i=0;i<n;i++) { if(s[i]!=c[i]) {g++; if(s[i]=='A') A++; else T++; } a2[i]=g; ca[i]=A; ct[i]=T; } } int get_distance(int x, int y) { int m=a2[y]-a2[x]+(s[x]!=c[x]); int q1=0,q2=0; if(x==0) { q1=ca[y]; q2=ct[y]; } else { q1=ca[y]-ca[x-1]; q2=ct[y]-ct[x-1]; } if(q1!=q2) return -1; else return m/2; return 0; }
#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...