제출 #602658

#제출 시각아이디문제언어결과실행 시간메모리
602658SifferDNA 돌연변이 (IOI21_dna)C++17
100 / 100
53 ms9524 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; vector<vector<int>> o; void init(string a, string b) { int n = a.size(); o.resize(n+1, vector<int>(6,0)); for(int i = 0; i < n; i++) { int k = 0; if(a[i]==b[i]) continue; if(a[i]=='A' && b[i]=='T') k = 0; if(a[i]=='T' && b[i]=='A') k = 1; if(a[i]=='C' && b[i]=='A') k = 2; if(a[i]=='A' && b[i]=='C') k = 3; if(a[i]=='T' && b[i]=='C') k = 4; if(a[i]=='C' && b[i]=='T') k = 5; o[i+1][k]++; } for(int i = 0; i < n; i++) for(int j = 0; j < 6; j++) o[i+1][j] += o[i][j]; } int get_distance(int x, int y) { int a = o[y+1][0]-o[x][0]; int b = o[y+1][1]-o[x][1]; int c = o[y+1][2]-o[x][2]; int d = o[y+1][3]-o[x][3]; int e = o[y+1][4]-o[x][4]; int f = o[y+1][5]-o[x][5]; if(a-b != c-d || a-b != e-f) return -1; return min(a,b)+min(c,d)+min(e,f)+2*abs(a-b); }
#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...