Submission #437440

#TimeUsernameProblemLanguageResultExecution timeMemory
437440MelonadeMutating DNA (IOI21_dna)C++17
0 / 100
50 ms2372 KiB
//yo dayo #include <bits/stdc++.h> using namespace std; int a[100005][7],n,q,x,y,res,tmp; int ac,at,ca,ct,ta,tc; string s1,s2; void init(string aa, string bb){ s1=aa; s2=bb; for (int i=0;i<n;i++){ a[i+1][1]=a[i][1]; a[i+1][2]=a[i][2]; a[i+1][3]=a[i][3]; a[i+1][4]=a[i][4]; a[i+1][5]=a[i][5]; a[i+1][6]=a[i][6]; if (s1[i]=='A' && s2[i]=='C') a[i+1][1]++; if (s1[i]=='A' && s2[i]=='T') a[i+1][2]++; if (s1[i]=='C' && s2[i]=='A') a[i+1][3]++; if (s1[i]=='C' && s2[i]=='T') a[i+1][4]++; if (s1[i]=='T' && s2[i]=='A') a[i+1][5]++; if (s1[i]=='T' && s2[i]=='C') a[i+1][6]++; } } int get_distance(int x, int y){ ac=a[y+1][1]-a[x][1]; at=a[y+1][2]-a[x][2]; ca=a[y+1][3]-a[x][3]; ct=a[y+1][4]-a[x][4]; ta=a[y+1][5]-a[x][5]; tc=a[y+1][6]-a[x][6]; res=0; tmp=min(ac,ca); res+=tmp; ac-=tmp; ca-=tmp; tmp=min(at,ta); res+=tmp; at-=tmp; ta-=tmp; tmp=min(tc,ct); res+=tmp; tc-=tmp; ct-=tmp; tmp=min(ac,min(ct,ta)); res+=tmp*2; ac-=tmp; ct-=tmp; ta-=tmp; tmp=min(ca,min(tc,at)); res+=tmp*2; ca-=tmp; tc-=tmp; at-=tmp; if (ac>0 || ca>0 || tc>0 || ct>0 || ta>0 || at>0) return -1; return res; }
#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...