#include <bits/stdc++.h>
#pragma GCC optimize ("O4")
#pragma GCC optimize ("fast-math")
#pragma GCC optimize ("unroll-loops")
using namespace std;
//#define int long long
#define ll long long
#define xx first
#define yy second
const int NMAX = 1e5;
int at[NMAX + 5], t[NMAX + 5], c[NMAX + 5];
int v[NMAX + 5];
string a, b;
void init (string as, string bs){
int n = as.length();
a = as;
b = bs;
for (int i = 1; i <= n; ++ i){
at[i] = at[i - 1];
t[i] = t[i - 1];
c[i] = c[i - 1];
v[i] = v[i - 1];
if (a[i - 1] == b[i - 1])
v[i] ++;
else if (a[i - 1] == 'A' && b[i - 1] == 'T')
at[i] ++;
else if (a[i - 1] == 'T' && b[i - 1] == 'A')
at[i] --;
else if (a[i - 1] == 'T' && b[i - 1] == 'C')
t[i] ++;
else if (a[i - 1] == 'C' && b[i - 1] == 'T')
t[i] --;
else if (a[i - 1] == 'C' && b[i - 1] == 'A')
c[i] ++;
else
c[i] --;
}
}
int get_distance(int x, int y){
y ++;
int unu = at[y] - at[x];
int doi = t[y] - t[x];
int trei = c[y] - c[x];
if (unu != doi || unu != trei)
return -1;
int val = abs (unu) * 2;
int ans = y - x;
val -= (v[y] - v[x]);
val -= abs(unu) * 3;
ans += val / 2;
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
3932 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
3932 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |