제출 #599630

#제출 시각아이디문제언어결과실행 시간메모리
599630FidanDNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "dna.h" using namespace std; typedef long long ll; const ll N=(1e5)+10; ll n; vector<ll> AT(N, 0); vector<ll> TA(N, 0); vector<ll> CA(N, 0); vector<ll> AC(N, 0); vector<ll> TC(N, 0); vector<ll> CT(N, 0); void init(string a, string b) { n=a.length(); a="."+a; b="."+b; for(ll i=1; i<=n; i++){ AT[i]=AT[i-1]; TA[i]=TA[i-1]; AC[i]=AC[i-1]; CA[i]=CA[i-1]; CT[i]=CT[i-1]; TC[i]=TC[i-1]; if(a[i]=='T' && b[i]=='A') TA[i]++; else if(a[i]=='A' && b[i]=='T') AT[i]++; else if(a[i]=='A' && b[i]=='C') AC[i]++; else if(a[i]=='C' && b[i]=='A') CA[i]++; else if(a[i]=='C' && b[i]=='T') CT[i]++; else if(a[i]=='T' && b[i]=='C') TC[i]++; } } int get_distance(int x, int y) { x++, y++; ll ac=AC[y]-AC[x-1]; ll ca=CA[y]-CA[x-1]; ll at=AT[y]-AT[x-1]; ll ta=TA[y]-TA[x-1]; ll tc=TC[y]-TC[x-1]; ll ct=CT[y]-CT[x-1]; ll k=0; if(ca+ta!=ac+at) return -1; if(ct+at!=tc+ta) return -1; if(ac+tc!=ca+ct) return -1; if(ca<ac){ swap(ca, ac); swap(at, ta); swap(tc, ct); } k+=ac+ta+ct; k+=2*(ca-ac); return k; } int main(){ ll m, q; cin>>m>>q; string a, b; cin>>a>>b; init(a, b); while(q--){ ll x, y; cin>>x>>y; cout<<get_distance(x, y)<<endl; } }

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

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