Submission #1001519

#TimeUsernameProblemLanguageResultExecution timeMemory
1001519vjudge1Mutating DNA (IOI21_dna)C++17
0 / 100
20 ms6324 KiB
#include "dna.h" #include<bits/stdc++.h> #pragma GCC optimize("-O3") #define ll int #define ld long double #define vl vector<ll> #define vi vector<int> #define pii pair<int, int> #define pll pair<ll, ll> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define f first #define s second #define pb push_back #define p_b pop_back using namespace std; const ll sz = 1e5+5; ll cnt[3][sz], cnt2[3][sz], pref[sz], i, n; void init(string a, string b) { a = '#' + a; b = '#' + b; n = a.size(); for(i = 1; i <= n; i++) pref[i] = pref[i-1] + (a[i] != b[i]); for(i = 1; i <= n; i++) { cnt[0][i] = cnt[0][i-1]; cnt[1][i] = cnt[1][i-1]; cnt[2][i] = cnt[2][i-1]; cnt2[0][i] = cnt2[0][i-1]; cnt2[1][i] = cnt2[1][i-1]; cnt2[2][i] = cnt2[2][i-1]; if(a[i] == 'A') cnt[0][i] = cnt[0][i-1] + 1; if(a[i] == 'C') cnt[1][i] = cnt[1][i-1] + 1; if(a[i] == 'T') cnt[2][i] = cnt[2][i-1] + 1; if(b[i] == 'A') cnt2[0][i] = cnt2[0][i-1] + 1; if(b[i] == 'C') cnt2[1][i] = cnt2[1][i-1] + 1; if(b[i] == 'T') cnt2[2][i] = cnt2[2][i-1] + 1; } } int get_distance(int x, int y) { x++, y++; ll acnt1 = cnt[0][y] - cnt[0][x-1]; ll ccnt1 = cnt[1][y] - cnt[1][x-1]; ll tcnt1 = cnt[2][y] - cnt[2][x-1]; ll acnt2 = cnt2[0][y] - cnt2[0][x-1]; ll ccnt2 = cnt2[1][y] - cnt2[1][x-1]; ll tcnt2 = cnt2[2][y] - cnt2[2][x-1]; if(acnt1 != acnt2 || ccnt1 != ccnt2 || tcnt1 != tcnt2) return -1; return pref[y] - pref[x-1] - 1; }
#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...