Submission #1150755

#TimeUsernameProblemLanguageResultExecution timeMemory
1150755zhasynDNA 돌연변이 (IOI21_dna)C++20
22 / 100
1595 ms2376 KiB
#include "dna.h" #include <bits/stdc++.h> #define pb push_back #define pf push_front using namespace std; #define F first #define S second typedef long long ll; #define pii pair <int, int> #define pll pair <ll, ll> typedef long double ld; const ll N = 1e5 + 100, M = 4096 + 10, len = 21, inf = 1e18; const ll mod = 1e9 + 7; string a, b; int n; void init(string ax, string bx) { a = ax; b = bx; n = (int)a.size(); } vector <int> vec[6]; int get_distance(int x, int y) { int ans = 0; for(int i = x, code; i <= y; i++){ if(a[i] == b[i]) continue; if(a[i] == 'A'){ if(b[i] == 'C') code = 2; else code = 0; } if(a[i] == 'T'){ if(b[i] == 'A') code = 1; else code = 4; } if(a[i] == 'C'){ if(b[i] == 'A') code = 3; else code = 5; } vec[code].pb(i); } bool can = true; for(int i = 0; i <= 4; i += 2){ if((int)vec[i].size() != (int)vec[i + 1].size()) can = false; ans += (int)vec[i].size(); } for(int i = 0; i <= 5; i++){ vec[i].clear(); } if(can) return ans; else return -1; } // int main(){ // ios::sync_with_stdio(false); // cin.tie(NULL); // string ax, bx; // cin >> ax >> bx; // init(ax, bx); // cout << get_distance(3, 5); // 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...