Submission #437434

#TimeUsernameProblemLanguageResultExecution timeMemory
437434MelonadeMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 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; } 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; } int main() { cin>>n>>q; cin>>s1; cin>>s2; init(s1,s2); 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]++; } while (q--) { cin>>x>>y; cout<<get_distance(x,y)<<"\n"; } }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccJplhXl.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc1R7s8l.o:dna.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status