Submission #783979

#TimeUsernameProblemLanguageResultExecution timeMemory
783979MatblubeMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include "dna.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
#define dbg(x) cerr<<#x<<": "<<x<<"\n";
#define fr(i, x) for(ll i=0 ; i<x ; i++)
#define fra(x, v) for(auto x:v)
#define fra1(x,v) for(auto &x:v)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pb(x) push_back(x)
#define F first
#define S second

string n, m;

void init(std::string a, std::string b) {
    n=a; m=b;
}

int get_distance(int x, int y) {
//    xdpro
    ll cc=0;
    for(ll i=x ; i<=y ; i++){
        if(a[i]!=b[i]) cc++;
    }
	return ((cc%2)?-1:cc/2);
}

Compilation message (stderr)

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:37:12: error: 'a' was not declared in this scope
   37 |         if(a[i]!=b[i]) cc++;
      |            ^
dna.cpp:37:18: error: 'b' was not declared in this scope
   37 |         if(a[i]!=b[i]) cc++;
      |                  ^