제출 #1034814

#제출 시각아이디문제언어결과실행 시간메모리
1034814ArthuroWichDNA 돌연변이 (IOI21_dna)C++17
21 / 100
24 ms6424 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; int prefa[100005][2], preft[100005][2], prefc[100005][2], prefmiss[100005]; void init(string a, string b) { int n = a.length(); for (int i = 1; i <= n; i++) { prefa[i][0] = prefa[i-1][0] + (a[i-1]=='A'); prefa[i][1] = prefa[i-1][1] + (b[i-1]=='A'); preft[i][0] = preft[i-1][0] + (a[i-1]=='T'); preft[i][1] = preft[i-1][1] + (b[i-1]=='T'); prefc[i][0] = prefc[i-1][0] + (a[i-1]=='C'); prefc[i][1] = prefc[i-1][1] + (b[i-1]=='C'); prefmiss[i] = prefmiss[i-1] + (a[i-1]!=b[i-1]); } } int get_distance(int x, int y) { y++; if (prefa[y][0]-prefa[x][0] != prefa[y][1]-prefa[x][1]) { return -1; } if (preft[y][0]-preft[x][0] != preft[y][1]-preft[x][1]) { return -1; } if (preft[y][0]-preft[x][0] != preft[y][1]-preft[x][1]) { return -1; } if (prefmiss[y]-prefmiss[x] == 1) { return -1; } if (prefmiss[y]-prefmiss[x] == 0) { return 0; } else { return prefmiss[y]-prefmiss[x]-1; } }
#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...