# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
596780 | serize | DNA 돌연변이 (IOI21_dna) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dna.h"
#include <bits/stdc++.h>
#include <cstdio>
#include <cassert>
#include <string>
#include <vector>
#define all(x) x.begin(),x.end()
using namespace std;
const int MAX = 1e5+2;
vector<int> dif(MAX);
string s1, s2;
void init(std::string a, std::string b) {
int n = a.size();
s1 = a, s2 = b;
for(int i = 1; i <= n; i++){
dif[i] = (a[i-1]!=b[i-1]);
dif[i] += dif[i-1];
}
}
int get_distance(int x, int y) {
//string cad1 = s1.substr(x,y), cad2 = s2.substr(x,y);
//sort(all(cad1));
//sort(all(cad2));
if(cad1 != cad2) return -1;
int d = dif[y+1]-dif[x];
if(d&1) return ((d>>1)+1);