제출 #459914

#제출 시각아이디문제언어결과실행 시간메모리
459914aris12345678DNA 돌연변이 (IOI21_dna)C++17
43 / 100
1582 ms3924 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; const int mxN = 100005; string s, t; void init(string a, string b) { s = a, t = b; } int not_fixed(string a, string b) { int ans = 0; for(int i = 0; i < int(a.length()); i++) { if(a[i] != b[i]) ans++; } return ans; } int ceil(int a, int b) { return a%b == 0 ? a/b : a/b+1; } int get_distance(int x, int y) { string a = s.substr(x, y-x+1), b = t.substr(x, y-x+1); string a1 = s.substr(x, y-x+1), b1 = t.substr(x, y-x+1); sort(a1.begin(), a1.end()); sort(b1.begin(), b1.end()); if(a1 != b1) return -1; if(x == y) { if(a == b) return 0; return -1; } else if(x+1 == y) { if(a == b) return 0; swap(a[0], a[1]); if(a == b) return 1; return -1; } else { if(a == b) return 0; return ceil(not_fixed(a, b), 2); } assert(true); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...