제출 #610838

#제출 시각아이디문제언어결과실행 시간메모리
610838OzyDNA 돌연변이 (IOI21_dna)C++17
0 / 100
36 ms10608 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; #define lli long long int #define debug(a) cout << #a << " = " << a << endl #define debugsl(a) cout << #a << " = " << a << ", " #define rep(i,a,b) for (int i = (a); i <= (b); i++) #define repa(i,a,b) for (int i = (a); i >= (b); i--) #define MAX 100000 lli acu[MAX+2][3][3]; lli act[3][3]; void init(std::string a, std::string b) { lli n = a.size(); lli x,y; rep(i,0,n-1) { if (a[i] == 'A') x = 0; else if (a[i] == 'T') x = 1; else x = 2; if (b[i] == 'A') y = 0; else if (b[i] == 'T') y = 1; else y = 2; rep(e,0,2) rep(j,0,2) acu[i][e][j] = acu[i-1][e][j]; acu[i][x][y]++; } } int get_distance(int x, int y) { rep(i,0,2) rep(j,0,2) act[i][j] = acu[y][i][j]; rep(i,0,2) rep(j,0,2) act[i][j] -= acu[x][i][j]; lli a,b,c,res = 0; res += min(act[0][2], act[2][0]); a = abs(act[0][2] - act[2][0]); res += min(act[0][1], act[1][0]); b = abs(act[0][1] - act[1][0]); res += min(act[1][2], act[2][1]); c = abs(act[1][2] - act[2][1]); if (a == b && b == c) res += a*2; else return -1; return res; }
#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...