제출 #923430

#제출 시각아이디문제언어결과실행 시간메모리
923430MarszpaceDNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; vector<int> diff; vector<int> aCountA,bCountA,aCountT,bCountT,aCountC,bCountC; void init(string a, string b){ if(a[0]!=b[0]){ diff.push_back(1); } else{ diff.push_back(0); } for(long long i=1;i<a.size();i++){ if(a[i]!=b[i]){ diff.push_back(diff[i-1]+1); } else{ diff.push_back(diff[i-1]); } } if(a[0]=='A'){ aCountA.push_back(1); aCountT.push_back(0); aCountC.push_back(0); } else if(a[0]=='T'){ aCountA.push_back(0); aCountT.push_back(1); aCountC.push_back(0); } else{ aCountA.push_back(0); aCountT.push_back(0); aCountC.push_back(1); } if(b[0]=='A'){ bCountA.push_back(1); bCountT.push_back(0); bCountC.push_back(0); } else if(b[0]=='T'){ bCountA.push_back(0); bCountT.push_back(1); bCountC.push_back(0); } else{ bCountA.push_back(0); bCountT.push_back(0); bCountC.push_back(1); } for(long long i=1;i<a.size();i++){ if(a[i]=='A'){ aCountA.push_back(aCountA[i-1]+1); aCountT.push_back(aCountT[i-1]); aCountC.push_back(aCountC[i-1]); } else if(a[i]=='T'){ aCountA.push_back(aCountA[i-1]); aCountT.push_back(aCountT[i-1]+1); aCountC.push_back(aCountC[i-1]); } else{ aCountA.push_back(aCountA[i-1]); aCountT.push_back(aCountT[i-1]); aCountC.push_back(aCountC[i-1]+1); } if(b[i]=='A'){ bCountA.push_back(bCountA[i-1]+1); bCountT.push_back(bCountT[i-1]); bCountC.push_back(bCountC[i-1]); } else if(b[i]=='T'){ bCountA.push_back(bCountA[i-1]); bCountT.push_back(bCountT[i-1]+1); bCountC.push_back(bCountC[i-1]); } else{ bCountA.push_back(bCountA[i-1]); bCountT.push_back(bCountT[i-1]); bCountC.push_back(bCountC[i-1]+1); } } } int get_distance(long long x, long long y){ x--; bool condA = (aCountA[y]-aCountA[x])==(bCountA[y]-bCountA[x]); bool condT = (aCountT[y]-aCountT[x])==(bCountT[y]-bCountT[x]); bool condC = (aCountC[y]-aCountC[x])==(bCountC[y]-bCountC[x]); //cout << endl << aCountA[y] << aCountA[x] << endl; if(!condA||!condT||!condC){ return -1; } long long res=diff[y]-diff[x]; return (res+1)/2; }

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

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:13:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(long long i=1;i<a.size();i++){
      |                       ~^~~~~~~~~
dna.cpp:52:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |     for(long long i=1;i<a.size();i++){
      |                       ~^~~~~~~~~
/usr/bin/ld: /tmp/ccVtMk2g.o: in function `main':
grader.cpp:(.text.startup+0x39d): undefined reference to `get_distance(int, int)'
collect2: error: ld returned 1 exit status