제출 #699143

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

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

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