제출 #1142121

#제출 시각아이디문제언어결과실행 시간메모리
1142121samiaDNA 돌연변이 (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;
    m['A']=0;
    m['T']=0;
     m1['A']=0;
    m1['T']=0;
    B=b;
}

int get_distance(int x, int y) {
  int ans;
  map<char,int>m;
    map<char,int>m1;
     int f[A.size()];
      f[0]=0;
 for(int so=0;so<A.size();so++){f[so]=0;}
     
      for(int so=0;so<A.size();so++){
          m[A[so]]+=1;
          m1[B[so]]+=1;
          if(so!=0){f[so]=f[so-1];}
          if(A[so]!=B[so]){f[so]+=1;}
      }
      if(m['A']==m1['A']&&m['T']==m1['T']){ return f[y]-f[x];}
      else {return -1;}
  
}

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

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:8:5: error: 'm' was not declared in this scope
    8 |     m['A']=0;
      |     ^
dna.cpp:10:6: error: 'm1' was not declared in this scope; did you mean 'y1'?
   10 |      m1['A']=0;
      |      ^~
      |      y1