제출 #1190372

#제출 시각아이디문제언어결과실행 시간메모리
1190372kokoueDNA 돌연변이 (IOI21_dna)C++20
21 / 100
19 ms4868 KiB
#include<bits/stdc++.h> #define ll long long #define f first #define s second using namespace std; const int maxn=1e5+10; int prefall[maxn]; int pref[2][3][maxn]; ///A ///C ///T void init(string a,string b) { for(int i=0;i<a.size();i++) { pref[0][0][i]=pref[0][0][i-1]; pref[0][1][i]=pref[0][1][i-1]; pref[0][2][i]=pref[0][2][i-1]; if(a[i]=='A') pref[0][0][i]++; if(a[i]=='C') pref[0][1][i]++; if(a[i]=='T') pref[0][2][i]++; } for(int i=0;i<b.size();i++) { pref[1][0][i]=pref[1][0][i-1]; pref[1][1][i]=pref[1][1][i-1]; pref[1][2][i]=pref[1][2][i-1]; if(b[i]=='A') pref[1][0][i]++; if(b[i]=='C') pref[1][1][i]++; if(b[i]=='T') pref[1][2][i]++; prefall[i]=prefall[i-1]; if(a[i]!=b[i]) prefall[i]++; } } int get_distance(int x,int y) { if(pref[0][0][y]-pref[0][0][x-1]!=pref[1][0][y]-pref[1][0][x-1]) return -1; if(pref[0][1][y]-pref[0][1][x-1]!=pref[1][1][y]-pref[1][1][x-1]) return -1; if(pref[0][2][y]-pref[0][2][x-1]!=pref[1][2][y]-pref[1][2][x-1]) return -1; return max(0,prefall[y]-prefall[x-1]-1); } /* TACAT TACAT TACAT TACAT CTATA CAATT AACTT TACAT */
#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...