This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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
if(n.size()!=m.size()) return -1;
map<char, ll>uwu1, uwu2;
for(ll i=x ; i<=y ; i++){
uwu1[n[i]]++;
uwu2[m[i]]++;
}
fra(pro, uwu1){
if(pro.second!=uwu2[pro.first]){
return -1;
}
}
fra(pro, uwu2){
if(pro.second!=uwu1[pro.first]){
return -1;
}
}
ll cc=0;
for(ll i=x ; i<=y ; i++){
if(n[i]!=m[i]) cc++;
}
return (cc+1)/2;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |