제출 #443832

#제출 시각아이디문제언어결과실행 시간메모리
443832fuad27DNA 돌연변이 (IOI21_dna)C++17
21 / 100
53 ms2372 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; string a, b; void init(string A, string B) { a = A; b = B; } int get_distance(int x, int y) { string A = "", B = ""; if(y - x == 0) { if(a[x] == b[x])return 0; return -1; } if(y-x == 1) { if(a[x] == b[x] and a[y] == b[y])return 0; if(a[y] == b[x] and a[x] == b[y])return 1; return -1; } else { int c = 0; set<char> s; for(int i = x;i<=y;i++) { s.insert(a[i]); A.push_back(a[i]); B.push_back(b[i]); if(a[i] != b[i])c++; } sort(A.begin(), A.end()); sort(B.begin(), B.end()); if(A != B) { return -1; } if(s.size() == 1)return 0; if(c == 0)return 0; if(s.size() == 2 and c == 2)return 1; if(s.size() == 3 and c == 2)return 1; if(s.size() == 3 and c == 3)return 2; return 0; } }
#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...