제출 #1122578

#제출 시각아이디문제언어결과실행 시간메모리
1122578I_FloPPed21DNA 돌연변이 (IOI21_dna)C++20
0 / 100
28 ms5024 KiB
#include <iostream> using namespace std; const int N=1e5+5; int sp_a[N],sp_b[N]; int a1[N],b1[N],c1[N]; int a2[N],b2[N],c2[N]; int difs[N]; int get_distance(int x,int y) { x++,y++; if(a1[y]-a1[x-1]!=a2[y]-a2[x-1]) return -1; if(b1[y]-b1[x-1]!=b2[y]-b2[x-1]) return -1; if(c1[y]-c1[x-1]!=c2[y]-c2[x-1]) return -1; int t=difs[y]-difs[x-1]; if(t%2==1) return -1; return t/2; } void init(string a,string b) { a="#"+a; b="#"+a; int n=a.size(); for(int i=1;i<=n;i++) { a1[i]+=a1[i-1]; a2[i]+=a[i-1]; b1[i]+=b1[i-1]; b2[i]+=b2[i-1]; c1[i]+=a1[i-1]; c2[i]+=a2[i-1]; if(a[i]=='A') a1[i]++; if(a[i]=='B') b1[i]++; if(a[i]=='T') c1[i]++; if(b[i]=='A') a2[i]++; if(b[i]=='B') b2[i]++; if(b[i]=='T') c2[i]++; difs[i]+=difs[i-1]; if(a[i]!=b[i]) difs[i]++; } }
#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...