제출 #1141902

#제출 시각아이디문제언어결과실행 시간메모리
1141902redacodeMutating DNA (IOI21_dna)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n,q; string a, b; cin >> n >> q; cin >> a; cin >> b; while(q--){ int x, y; cin >> x >> 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+=a[i]; if(a[i]=='A')freq1[0]++; if(a[i]=='B')freq1[1]++; if(a[i]=='C')freq1[2]++; bx+=b[i]; if(b[i]=='A')freq2[0]++; if(b[i]=='B')freq2[1]++; if(b[i]=='C')freq2[2]++; } if(freq1[0]!=freq2[0] or freq1[1]!=freq2[1] or freq1[2]!=freq2[2]){ cout << -1 << endl; }else if(x-y==2){ //cout << ax << " " << bx; if(ax==bx){ cout << 0 << endl; }else if((ax[0]==bx[1] and ax[1]==bx[0]) or (ax[2]==bx[1] and ax[1]==bx[2])){ cout << 1 << endl; }else{ cout << 2 << endl; } }else{ if(ax==bx){ cout << 0 << endl; }else{ cout << 1 << endl; } } } }

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

/usr/bin/ld: /tmp/ccLyvygW.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc10FOSt.o:dna.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccLyvygW.o: in function `main':
grader.cpp:(.text.startup+0x363): undefined reference to `init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: grader.cpp:(.text.startup+0x39a): undefined reference to `get_distance(int, int)'
collect2: error: ld returned 1 exit status