Submission #1033473

#TimeUsernameProblemLanguageResultExecution timeMemory
1033473PokemonMasterMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int n,q; string a,b; void init(string a,string b) { cin>>a>>b; } int get_distance(int x,int y) { string na="",nb=""; map <char,int> mp1,mp2; for(int i=x;i<=y;i++) { na+=a[i]; nb+=b[i]; } string ca=na,cb=nb; sort(ca.begin(),ca.end()); sort(cb.begin(),cb.end()); if(ca!=cb) { return -1; } int cnt=0,res=0; while(na!=nb) { int ind=0; for(int j=cnt;j<=n;j++) { if(na[j]==nb[cnt]) { ind=j; break; } } while(ind!=cnt) { swap(na[ind],na[ind-1]); ind--; res++; } cnt++; } return res; } signed main() { cin>>n>>q>>a>>b; for(int i=1;i<=q;i++) { int l,r; cin>>l>>r; cout<<get_distance(l,r)<<endl; } }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccK99ToN.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccmoaxiQ.o:dna.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccK99ToN.o: in function `main':
grader.cpp:(.text.startup+0x39d): undefined reference to `get_distance(int, int)'
collect2: error: ld returned 1 exit status