제출 #529192

#제출 시각아이디문제언어결과실행 시간메모리
529192Icebear16DNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include "dna.h" long long n,q; std::string s; std::string c; void init(std::string a, std::string b) { s=a,c=b; while(q--){ long long x,y; get_distance(x,y); } } int get_distance(long long x, long long y) { long long h1=0,h2=0,l1=0,l2=0,k1=0,k2=0; for(long long i=x;i<=y;i++){ if(s[i]=='A'){ h1++; }else if(s[i]=='T'){ l1++; }else if(s[i]=='C'){ k1++; } if(c[i]=='A'){ h2++; }else if(c[i]=='T'){ l2++; }else if(c[i]=='C'){ k2++; } } if(h1==h2 && l1==l2 && k1==k2){ long long j=0; for(long long i=x;i<=y;i++){ if(s[i]!=c[i]){ j+=1; } } if(j%2==1){ j+=1; } return j/2; }else{ return -1; } }

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

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:9:15: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
    9 |   get_distance(x,y);
      |   ~~~~~~~~~~~~^~~~~
dna.cpp:9:15: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
/usr/bin/ld: /tmp/ccux7Stl.o: in function `main':
grader.cpp:(.text.startup+0x39d): undefined reference to `get_distance(int, int)'
/usr/bin/ld: /tmp/ccEBcTFk.o: in function `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> >)':
dna.cpp:(.text+0x35): undefined reference to `get_distance(int, int)'
collect2: error: ld returned 1 exit status