제출 #697694

#제출 시각아이디문제언어결과실행 시간메모리
697694europiumDNA 돌연변이 (IOI21_dna)C++17
0 / 100
39 ms6888 KiB
#include "dna.h" #include <cstdio> #include <cassert> #include <string> #include <vector> #include <iostream> using namespace std; vector<int> ta, aa, ca, tb, ab, cb, same; void init(string a, string b){ int n = a.size(); ta.resize(n + 1); aa.resize(n + 1); ca.resize(n + 1); tb.resize(n + 1); ab.resize(n + 1); cb.resize(n + 1); same.resize(n + 1); for (int i = 1; i <= n; i++){ ta[i] = ta[i-1] + (a[i-1] == 'T'); aa[i] = aa[i-1] + (a[i-1] == 'A'); ca[i] = ca[i-1] + (a[i-1] == 'C'); tb[i] = tb[i-1] + (b[i-1] == 'T'); ab[i] = ab[i-1] + (b[i-1] == 'A'); cb[i] = cb[i-1] + (b[i-1] == 'C'); same[i] = same[i-1] + (a[i-1] == b[i-1]); } for (int i = 0; i <= n; i++) cout << same[i] << ' '; cout << '\n'; } int get_distance(int x, int y){ if (ta[y+1] - ta[x] != tb[y+1] - tb[x] || aa[y+1] - aa[x] != ab[y+1] - ab[x] || ca[y+1] - ca[x] != cb[y+1] - cb[x]) return -1; return (y - x) - (same[y+1] - same[x]); }
#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...