# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
482624 | rc_catunta | Mutating DNA (IOI21_dna) | C++17 | 37 ms | 3864 KiB |
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 <algorithm>
using namespace std;
string sa,sb;
void init(string a, string b) {
sa=a;
sb=b;
}
int get_distance(int x, int y) {
if(y-x<=2){
string a=sa.substr(x,y-x+1);
string b=sb.substr(x,y-x+1);
if(a==b) return 0;
string ca = a;
string cb = b;
sort(ca.begin(),ca.end());
sort(cb.begin(),cb.end());
if(ca != cb) return -1;
int cm = 0;
for(int i=0;i<a.size();i++){
if(a[i]==b[i]) cm++;
}
if(a.size()==3) return 2-cm;
if(a.size()==2) return 1-cm;
}
return 0;
}
Compilation message (stderr)
# | 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... |