Submission #1141968

#TimeUsernameProblemLanguageResultExecution timeMemory
1141968walaelaa13Mutating 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(std::string A, std::string B) {
    a=A;
    b=B;
}

int get_distance(int x, int y) {
    string suba= a.substr(x, y);
    string subb= b.substr(x, y);
    int A=count(suba.begin(), suba.end(), A);
    int B=count(subb.begin(), subb.end(), A);
    if(A!=B) return -1;
    sol=0;
    for(int i=0;i<y-x;i++){
        if(sub[i]!=subb[i]){
            sol++;
            
            
        }
    }
	return sol;
}

Compilation message (stderr)

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:16:5: error: 'sol' was not declared in this scope
   16 |     sol=0;
      |     ^~~
dna.cpp:18:12: error: 'sub' was not declared in this scope; did you mean 'subb'?
   18 |         if(sub[i]!=subb[i]){
      |            ^~~
      |            subb