제출 #1141993

#제출 시각아이디문제언어결과실행 시간메모리
1141993rayankDNA 돌연변이 (IOI21_dna)C++20
컴파일 에러
0 ms0 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; string A; string B; void init(string a, string b) { A = a; B = b; } int find_pos(char c, string s, int start, int end){ for(int i = start; i <= end; i++){ if(s[i] == c){ return i; } } return -1; } int get_distance(int x, int y) { int res = 0; string suba = A.substr(x, y); string subb = B.substr(x,y); string subacopy = suba; string subbcopy = subb; sort(subacopy.begin(), subacopy.end()); sort(subbcopy.begin(), subbcopy.end()); if(subbcopy != subacopy){ return -1; } while(suba != subb){ for(int i=0; i <suba.size();i++){ if(suba[i] == subb[i]) continue; int pos = find_pos(suba[i], subb, 0, y-x+1); swap(suba[i], suba[pos]); res++; } } return res; } 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; } }

컴파일 시 표준 에러 (stderr) 메시지

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