제출 #1142615

#제출 시각아이디문제언어결과실행 시간메모리
1142615sam12345678910112Mutating DNA (IOI21_dna)C++20
컴파일 에러
0 ms0 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; string A,B; void init(string a, string b) { A=a; B=b; } int get_distance(int x, int y) { int count; map<char,int>m2; map<char,int>m1; ans=0; for(int so=x;so<=y;so++){ if(A[so]!=B[so]){count++;m2[A[so]]+=1;m1[B[so]]+=1;} } if(m1['A']==m2['A']&&m1['C']==m2['C']&&m1['T']==m2['T']){ return max(0,count-1); } else {return -1;} }

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

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:15:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |       ans=0;
      |       ^~~
      |       abs