제출 #699030

#제출 시각아이디문제언어결과실행 시간메모리
699030NourWaelDNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { int n,q; cin>>n>>q; string f,s; cin>>f>>s; int difference=0; int d[100001]; vector<vector<int>>numbersA(n+1,vector<int>(3)); vector<vector<int>>numbersB(n+1,vector<int>(3)); int aa=0; int ta=0; int ca=0; int ab=0; int tb=0; int cb=0; for(int i=0; i<f.size(); i++) { if(f[i]!=s[i]) { difference++; } d[i]=difference; if(f[i]=='A') { aa++; } else if (f[i]=='T') { ta++; } else if (f[i]=='C') { ca++; } numbersA[i][0]=aa; numbersA[i][1]=ta; numbersA[i][2]=ca; if(s[i]=='A') { ab++; } else if (s[i]=='T') { tb++; } else if (s[i]=='C') { cb++; } numbersB[i][0]=ab; numbersB[i][1]=tb; numbersB[i][2]=cb; } while(q--) { int x,y; cin>>x>>y; int div=d[y]; int da1=numbersA[y][0]; int dt1=numbersA[y][1]; int dc1=numbersA[y][2]; int da2=numbersB[y][0]; int dt2=numbersB[y][1]; int dc2=numbersB[y][2]; if(x!=0) { div=d[y]-d[x-1]; da1-=numbersA[x-1][0]; dt1-=numbersA[x-1][1]; dc1-=numbersA[x-1][2]; da2-=numbersB[x-1][0]; dt2-=numbersB[x-1][1]; dc2-=numbersB[x-1][2]; } if(da1==da2 && dt1==dt2 && dc1==dc2) { cout<<ceil((double)div/2)<<'\n'; } else { cout<<-1<<'\n'; } } return 0; }

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

dna.cpp: In function 'int main()':
dna.cpp:25:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int i=0; i<f.size(); i++)
      |                  ~^~~~~~~~~
/usr/bin/ld: /tmp/ccZph2P1.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccpV3TP0.o:dna.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccZph2P1.o: in function `main':
grader.cpp:(.text.startup+0x366): 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+0x39d): undefined reference to `get_distance(int, int)'
collect2: error: ld returned 1 exit status