Submission #1142035

#TimeUsernameProblemLanguageResultExecution timeMemory
1142035redacodeMutating DNA (IOI21_dna)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; string k,d; void init(std::string a, std::string b) { k=a,d=b; } int get_distance(int x, int y) { string ax=""; string bx=""; int freq1[3]={0,0,0}; int freq2[3]={0,0,0}; for(int i=x;i<=y;i++){ ax+=k[i]; if(k[i]=='A')freq1[0]++; if(k[i]=='B')freq1[1]++; if(k[i]=='C')freq1[2]++; bx+=d[i]; if(d[i]=='A')freq2[0]++; if(d[i]=='B')freq2[1]++; if(d[i]=='C')freq2[2]++; } if(freq1[0]!=freq2[0] or freq1[1]!=freq2[1] or freq1[2]!=freq2[2]){ return -1; } if(y-x==2){ //cout << ax << " " << bx; if(freq1[0]!=freq2[0] or freq1[1]!=freq2[1] or freq1[2]!=freq2[2]){ return -1; } if(ax==bx){ return 0; }else if((ax[0]==bx[1] and ax[1]==bx[0]) or (ax[2]==bx[1] and ax[1]==bx[2])){ return 1; }else if(ax[0]==bx[2] and ax[2]==bx[0] and ax[1]!=bx[1]){ return 3; }else{ return 2; } }else if(y-x==1){ if(freq1[0]!=freq2[0] or freq1[1]!=freq2[1]){ return -1; } if(ax==bx){ return 0; }else{ return 1; } }else{ return 1; } } int main() { int n,q; cin>>n>>q; string a,b; cin>>a>>b; init(a,b); while(q--){ int x,y; cin>>x>>y; cout<<get_distance(x,y)<<endl; } }

Compilation message (stderr)

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