Submission #969057

# Submission time Handle Problem Language Result Execution time Memory
969057 2024-04-24T12:42:29 Z andro Mutating DNA (IOI21_dna) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

#include "dna.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) {
    int ans = 0;
    map<int,int> M, M1;
	for(int i = x; i <= y; i++) {
        if(A[i] != B[i]) {
            ans += 1;
        }
        M[a[i]] += 1;
        M1[b[i]] += 1;
	}
	if(M['A'] != M1['A'] || M['T'] != M1['T']) {
        ans = - 1;
	}
	return ans;
}

Compilation message

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:21:11: error: 'a' was not declared in this scope
   21 |         M[a[i]] += 1;
      |           ^
dna.cpp:22:12: error: 'b' was not declared in this scope
   22 |         M1[b[i]] += 1;
      |            ^