This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "dna.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb(e) push_back(e)
#define sv(a) sort(a.begin(),a.end())
#define sa(a,n) sort(a,a+n)
#define mp(a,b) make_pair(a,b)
#define vf first
#define vs second
#define ar array
#define all(x) x.begin(),x.end()
const int inf = 0x3f3f3f3f;
const int mod = 1000000007;
const double PI=3.14159265358979323846264338327950288419716939937510582097494459230;
bool remender(ll a , ll b){return a%b;}
const int N = 100002;
int cnt[N] , cnt1[N];
void init(std::string a, std::string b) {
int n = a.size();
for(int i = 0; i < n; i++){
cnt[i] = 0;
cnt1[i] = 0;
if(i){cnt[i] = cnt[i-1];cnt1[i] = cnt1[i-1];}
if(a[i] != b[i]){
if(a[i] == 'A')cnt[i]++;
else cnt1[i]++;
}
}
}
int get_distance(int x, int y) {
int ans = cnt[y];
int ans1 = cnt1[y];
if(x-1 >= 0){ans -= cnt[x-1];ans1-=cnt1[x-1];}
if(ans == ans1){
return ans;
}
else return -1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |