Submission #1142615

#TimeUsernameProblemLanguageResultExecution timeMemory
1142615sam12345678910112Mutating DNA (IOI21_dna)C++20
Compilation error
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;} 
  
}

Compilation message (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