제출 #1009502

#제출 시각아이디문제언어결과실행 시간메모리
1009502somefjordDNA 돌연변이 (IOI21_dna)C++17
0 / 100
18 ms6744 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; string as, bs; vector<int> acount1, acount2, tcount1, tcount2, misplacecount; void init(string a, string b) { as = a; bs = b; int n = a.length(); acount1.resize(n + 2, 0); acount2.resize(n + 2, 0); misplacecount.resize(n + 2, 0); for (int i = 1; i <= n; ++i) { acount1[i] = acount1[i - 1] + (as[i - 1] == 'A'); acount2[i] = acount2[i - 1] + (bs[i - 1] == 'A'); tcount1[i] = tcount1[i - 1] + (as[i - 1] == 'T'); tcount2[i] = tcount2[i - 1] + (bs[i - 1] == 'T'); misplacecount[i] = misplacecount[i - 1] + (as[i - 1] == 'A' && as[i - 1] != bs[i - 1]); // printf("i : %d, %d %d %d\n", i, acount1[i], acount2[i], // misplacecount[i]); } } int get_distance(int x, int y) { if ((acount1[y] - acount1[x]) != (acount2[y] - acount2[x]) || tcount1[y] - tcount1[x] != tcount2[y] - tcount2[x]) return -1; return misplacecount[y] - misplacecount[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...