제출 #922664

#제출 시각아이디문제언어결과실행 시간메모리
922664tvladm2009DNA 돌연변이 (IOI21_dna)C++17
0 / 100
44 ms22804 KiB
#include "dna.h" #include <iostream> #include <complex> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <numeric> #include <cstring> #include <ctime> #include <cstdlib> #include <set> #include <map> #include <unordered_map> #include <unordered_set> #include <list> #include <cmath> #include <bitset> #include <cassert> #include <queue> #include <stack> #include <deque> #include <random> using namespace std; template<typename T1, typename T2> inline void chkmin(T1 &a, T2 b) {if (a > b) a = b;} template<typename T1, typename T2> inline void chkmax(T1 &a, T2 b) {if (a < b) a = b;} #define files(FILENAME) read(FILENAME); write(FILENAME) #define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin) #define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout) #define all(c) (c).begin(), (c).end() #define sz(c) (int)(c).size() #define left left228 #define right right228 #define y1 y1228 #define mp make_pair #define pb push_back #define y2 y2228 #define rank rank228 using ll = long long; using ld = long double; const string FILENAME = "input"; const int MAXN = 100228; int cntA[MAXN][26], cntB[MAXN][26]; int diff[MAXN]; void init(string a, string b) { int n = sz(a); for (int i = 1; i <= n; i++) { for (int j = 0; j < 26; j++) { cntA[i][j] = cntA[i - 1][j]; } cntA[i][a[i - 1] - 'a']++; } for (int i = 1; i <= n; i++) { for (int j = 0; j < 26; j++) { cntB[i][j] = cntB[i - 1][j]; } cntB[i][b[i - 1] - 'a']++; } for (int i = 1; i <= n; i++) { diff[i] = diff[i - 1] + (a[i - 1] != b[i - 1]); } } int get_distance(int l, int r) { for (int j = 0; j < 26; j++) { if (cntA[r][j] - cntA[l - 1][j] != cntB[r][j] - cntB[l - 1][j]) { return -1; } } int x = diff[r] - diff[l - 1]; return (x + 1) / 2; } /** int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); //read(FILENAME); return 0; } **/
#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...