# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
952242 | 2024-03-23T11:17:37 Z | wood | DNA 돌연변이 (IOI21_dna) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> p32; typedef pair<ll, ll> p64; #define pb push_back #define eb emplace_back #define fi first #define se second #define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define MOD %1000000007 vector<int> pref_b; vector<int> pref_a; vector<int> matchpref; void init(string a, string b) { int n = a.size(); pref_a.resize(n); pref_b.resize(n); matchpref.resize(n); for (size_t i = 0; i < a.size(); i++) { pref_a[i + 1] = pref_a[i] + (a[i] == 1); pref_b[i + 1] = pref_b[i] + (b[i] == 1); matchpref[i + 1] = (a[i] == 1) && (b[i] == 1); } } int get_distance(int x, int y) { if (pref_a[y + 1] - pref_a[x] - pref_b[y + 2] - pref_b[x]) { return -1; } else return (pref_a[y + 1] - pref_a[x] - matchpref[y + 1] + matchpref[x]); } #ifndef ONLINE_JUDGE int main() { fast_cin(); return 0; } #endif